New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webflux: contextPath not used while behind a load balancer/reverse proxy #1109
Comments
Please read this section: |
@bnasslahsen I did read this section actually. I tried all of it (version 1.5.6 BTW) server.forward-headers-strategy=native OR framework I also added cause I'm using reactive. @Bean
ForwardedHeaderTransformer forwardedHeaderTransformer() {
return new ForwardedHeaderTransformer();
} the contextPath is '/transcodification' First root call is good with a temporary redirect Then redirect to UI with the right contextPath but not the queryParam configUrl |
You should make sure your proxy sends the correct headers, as described. Make sure your restart your application after the configuration changes. For example, using Apache 2, configuration:
If you are still facing this problem: You can set manually the configurl as workaround and test if it's ok. If it's working after setting the configUrl manually, this means it's a bug and we can reopen the issue. |
I set Only redirect to if I set |
Can you Provide a Minimal, Reproducible Example - with HelloController that reproduces the problem ? |
OK here's a minimal project that reproduces the problem. Sorry if I did something wrong. |
This should be fixed with the latest SNAPSHOT. |
Just tested with 1.5.7-SNAPSHOT and it seems to work great behind my Traefik container. It works with: just OR just with bean injected @Bean
ForwardedHeaderTransformer forwardedHeaderTransformer() {
return new ForwardedHeaderTransformer();
} Thank you! |
For now, you can try springdoc version 1.4.8, it works fine for me. |
@bnasslahsen Hi. This bug reappears in version 1.6.9 |
SwaggerUI doesn't work at all while behind a reverse proxy like Traefik even if good HTTP Headers are sent.
contextPath is available but doesn't seem to be used as you can see below
springdoc-openapi/springdoc-openapi-common/src/main/java/org/springdoc/ui/AbstractSwaggerWelcome.java
Line 207 in 1346f01
springdoc-openapi/springdoc-openapi-common/src/main/java/org/springdoc/ui/AbstractSwaggerWelcome.java
Line 197 in 1346f01
I tried setting this.swaggerConfigUrl and this.apiDocsUrl by appending default urls to the contextPath as we could expect according to the method signatures and it works well behind Traefik.
Is it really an issue that contextPath variable in thoses methods are not used?
The text was updated successfully, but these errors were encountered: