Skip to content

ServletUriComponentsBuilder should replace context path when X-Forwarded-Prefix is present [SPR-16650] #21191

Closed
@spring-projects-issues

Description

@spring-projects-issues

Antonio Petrelli opened SPR-16650 and commented

ServletUriComponentsBuilder.fromContextPath, if the X-Forwarded-Prefix header is present, prepends the header value to the context path.
It should, instead, replace it, since this is what ForwardedHeaderFilter does.

In my case I see URLs in Spring Data Rest results are affected.

Workaround: use ForwardedHeaderFilter instead of relying on ServletUriComponentsBuilder.


Affects: 4.3.14

Issue Links:

Referenced from: commits 986d219, 240d6f5

Backported to: 4.3.15

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions