-
-
Notifications
You must be signed in to change notification settings - Fork 523
404 error with spring doc open api 2.1.0 #2204
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
So the problem is, my service sits behind API Gateway, when the request is routed to my service the url used for routing is https://somecomp.com/swagger-ui.html hence when the swagger redirects it redirects to 'https://somecomp.com/webjars/swagger-ui/index.html'. The request goes back to the api gateway and since the service is missing the routing fails. Now I have created a WebFilter to add the service1 explicitly for requests that have uri as '/webjars/swagger-ui'. But this still does not work and swagger-config is failing : I have added the same logic to append the service name in case of uri as /v3/api-docs/swagger-config and /v3/api-docs. If I use the configuration It worked after adding springdoc.swagger-ui.url: /service1/v3/api-docs |
For me this issue was resolved by adding: <dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.45</version>
</dependency> The locator was removed with the following commit: Unfortunately I was not able to understand why this was done, maybe to not depend on the locator directly but this is just an assumption. Anyways this was necessary that the resource Lines 31 to 39 in 10bd991
The application is now using the following dependencies: <dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.45</version>
</dependency> if you're using wildfly use the following locator: <dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-jboss-vfs</artifactId>
<version>0.1.0</version>
</dependency> |
Hi @matt-hires , I tried the above but it does not solve my problem. If there is any way by which swagger ui renders without redirection probably that would work best, but the above workaround I have put in place also works. |
In case it helps anyone here, I ran into this when upgrading to Spring Boot 3.2.0. Suddenly
|
Hi,
I am facing a similar issue. On accessing https://somecomp.com/service1/swagger-ui.html it redirects to https://somecomp.com/service1/swagger/index.html and then returns error 404.
I am using 'spring-boot-starter-webflux:3.0.3' with 'springdoc-openapi-starter-webflux-ui:2.1.0'. Following is the configuration in my application.yml:
`springdoc:
packagesToScan: com.somecomp
swagger-ui:
defaultModelsExpandDepth: -1
path: "/swagger-ui.html"
webjars:
prefix: /service1
Is there a way to disable the redirection and render swagger from https://somecomp.com/service1/swagger-ui.html
The text was updated successfully, but these errors were encountered: