0

I have a Spring Boot application deployed and configured as AWS Route 53 > AWS Load Balance -> 2 EC2 instances which hosted the Spring Boot application.

The URL for the Swagger is https://applicationXYZ.company.net/release/swagger-ui.html

I'm able to see the page without any issue. But we can't use the 'Tryout' feature because the Base URL is wrong.

On top of the page I do see information as [ Base URL: service/release]

enter image description here

I have no idea where 'service' became my base URL. I also hit api-docs and also see 'server' in 'host' field.

Could you please help on this?

Note: I'm using Spring Boot Starter 2.0.8.RELEASE and Swagger 2.9.2 (without any Spring Security)

Thanks,

Nghia Do
  • 2,588
  • 2
  • 17
  • 31

1 Answers1

0

Did you ever try to make a redirect,

//Do redirection inside controller
@RequestMapping("/swagger")
public String greeting() {
    return "redirect:/swagger-ui.html";
}

you can try to add bean too, inside main method,

@Bean
RouterFunction<ServerResponse> routerFunction() {
    return route(GET("/swagger"), req ->
        ServerResponse.temporaryRedirect(URI.create("swagger-ui.html")).build());
}

refer: How to change Swagger-ui URL prefix?

Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29