I am using this OpenAPI 3 implementation in Spring Boot web project.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
My configuration for OpenAPI:
@Configuration
public class SpringFoxConfig {
@Value("${openapi.server.baseUrl}")
private String baseUrl;
@Bean
public OpenAPI customOpenAPI() {
Server server = new Server();
server.setUrl(baseUrl);
List<Server> servers = new ArrayList<>();
servers.add(server);
return new OpenAPI()
.components(new Components())
.servers(servers)
.info(new Info().title("Service REST API").description(
"Generic Service REST API"));
}
}
The value of the baseUrl is: https://apps.server.com/test/myservice
This service is running on a docker-swarm and is exposed via Nginx and Kong API gateway.
Web browser -> Nginx -> Kong -> Service
I am trying not to touch the Nginx server as much as possible and having created a service (protocol: http, port: 8080, host: service-name-in-kong) and route (paths: /myservice/ and /myservice) using Konga GUI tool.
When trying to access the swagger-ui.html at https://apps.server.com/test/myservice/swagger-ui.html -> it gets redirected to http://service-name-in-kong:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config#/
Now i am confused as to why this happens?