-
-
Notifications
You must be signed in to change notification settings - Fork 523
External context path is not respected when using Swagger UI #607
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
Comments
If you are reporting a bug, please help to speed up problem diagnosis by providing as much information as possible:
|
@bnasslahsen thanks for your reply
Actually inside the pod it is running at http://localhost/swagger/api but Ingress exposes it to outside world on http://some-url/some-path/swagger/api The problem here is that when I visit http://some-url/some-path/swagger/ui it redirects to http://some-url/swagger/swagger-ui/index.html?configUrl=/swagger/api/swagger-config where correct url would be http://some-url/some-path/swagger/swagger-ui/index.html?configUrl=/some-path/swagger/api/swagger-config. It removes |
You should set the correct spring-boot properties and the configuration of your web server to forward the correct headers : 1)- On your spring-boot app, you should have: server.forward-headers-strategy=framework 2)- You need to make sure the following header is set in your reverse proxy configuration (ingress in your case): More details available here: |
Indeed the issue was on my application. Thank you for your help. I fixed it as you suggested. I am closing this issue |
Version: springdoc-openapi-ui 1.3.4
If I deploy my application K8s with some custom path, swagger UI redirection does not work. It looks for the
spring context path
+springdoc.api-docs.path
. So it does not work with relative paths.Lets say I have:
But with K8s and Ingress my application runs at http://api.someurl.com/my-custom-path/foo/ and http://api.someurl.com/my-custom-path/foo/swagger/api works fine
But when I visit http://api.someurl.com/my-custom-path/foo/swagger/ui it redirects to http://api.someurl.com/foo/swagger/swagger-ui/index.html?configUrl=/foo/swagger/api/swagger-config
So it removes
my-custom-path
from the redirected URL.The text was updated successfully, but these errors were encountered: