Description
Thibaud Lepretre opened SPR-14376 and commented
With latest ForwardedHeaderFilter
executed on Spring application that is using context-path
server.context-path: /bar
If X-Forwarded-Prefix: /foo
is present the following url http://blabla.com/bar/oauth/authorize will be converted to http://blabla.com/foo/oauth/authorize
However with following architecture (1) Reverse proxy SSL
with context path /foo
, (2) Zuul without context path
and (3) Microservice BAR
with context path /bar
: rendering request will not work because http://blabla.com/foo/oauth/authorize will be 404
.
Expected result should be http://blabla.com/foo/bar/oauth/authorize.
However I'm aware that for some other use cases context-path should be replaced and not prepended (like I wish). So the issue is debatable.
Possible solutions:
- Clearly document that
X-Forwarded-Prefix
will not really prefix but replace the existing context-path - Add option to choose strategy between prepending or replacing
- If you consider it as a bug, just prepend.
For example Spring cloud netflix prepends X-Forwarded-Prefix
during Zuul
filtering https://github.com/spring-cloud/spring-cloud-netflix/pull/994/files#diff-8a3a3948fd59a02ea4234d960437c3a0R120
Affects: 4.3 GA
Issue Links:
- ForwardedHeaderFilter could support X-Forwarded-Prefix as well [SPR-14270] #18842 ForwardedHeaderFilter could support X-Forwarded-Prefix as well
- ForwardedHeaderFilter should support case insensitive header name [SPR-14372] #18945 ForwardedHeaderFilter should support case insensitive header name