I have a Java 11 Spring Boot 2.5.1 application.
Swagger works locally via http:
I have added Swagger, which works perfectly on my localhost:
http://localhost:8085/swagger-ui/index.html#/
Swagger does not work remotely via https:
However, when I deploy it to a remote server, I get the following error:
Error
Failed to load remote configuration.
note: the remote server is accessed via https.
The REST endpoints are accessible on the remote server.
{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8085/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}
Remotely, there is a call to:
But https://mycompany.co/pow-wow/v3/api-docs/swagger-config
returns:
{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8085/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}
So this suggests the issue is related to the /pow-wow
context path is missing in the call.
CodePudding user response:
Try to add this as well to your security config class
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/swagger-ui/**", "/v3/api-docs/**");
}
CodePudding user response:
You should try and add
springdoc:
swagger-ui:
config-url: /pow-wow/v3/api-docs/swagger-config
url: /v3/api-docs
to your application.properties. In your provided example
https://mycompany.co/pow-wow/v3/api-docs/swagger-config
it shows that you have "/pow-wow/" in your path. Swagger needs to know where to fetch its config.