SpringBoot with Swagger redirecting wrongly

108 Views Asked by At

I am using Swagger with a SpringBoot project, behind a reverse proxy. When I try to access https://localhost:8080/api, instead of redirecting me to https://localhost:8080/api/swagger-ui/index.html, it redirects me to https://<my computer host in the network>:8081/api/swagger-ui/index. However, when I access https://localhost:8080/api/ (note the trailing /), it works perfectly as intended.

I When I execute a curl -v -k https://localhost:8080/api I get the following output:

> GET /api HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.76.1
> Accept: */*

And

< HTTP/1.1 302 Found
< transfer-encoding: chunked
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< Location: https://<my computer host in the network>:8081/api/
< Date: Thu, 23 Nov 2023 09:32:01 GMT

I am assuming SpringBoot is redirecting things wrong somewhere. I just can't figure out where.

0

There are 0 best solutions below