mitre/HTTP-Proxy-Servlet

Proxy to spring boot application with X-Forwarded headers ?

fxprunayre opened this issue · 2 comments

Is there any configuration to set X-Forwarded-Host, Proto and Prefix headers to the proxyRequest ?

https://stackoverflow.com/questions/59126518/how-to-cope-with-x-forwarded-headers-in-spring-boot-2-2-0-spring-web-mvc-behin

The requirement is to have servletRequest.getRequestURL() in the Spring Boot app to return the URL of the app proxying the call.

Thanks.

A quick search in this repo turns up this:
#104
Did that feature not address what you need?

#104 is related but I did not managed to make it work with the spring boot app behind the proxy.

It sounds like X-Forwarded-Host has to be set to work properly when you enable server.forward-headers-strategy=FRAMEWORK on spring boot side. Then only the Host header was set
https://github.com/mitre/HTTP-Proxy-Servlet/pull/104/files#diff-9b730ddb85e87a5d4f1d33f1d3b7a555480c517bbec0037de2caa9412c8f0ba2R464 and at least I did not managed to make it work. Maybe there is some Spring boot config option to use the Host header ...

I workaround the issue with https://github.com/geonetwork/core-geonetwork/pull/5604/files#diff-864867ffa0e2b294f0ec0d4f6a957f44c0320a822d82a9f1cc1f680896159ee8R110-R118 which is fine for now. Was asking in case someone has a hint on this and check if that is something to support.