I have Swagger UI configured as such:
(require '[reitit.ring :as ring])
(require '[reitit.swagger-ui :as swagger-ui])
(ring/ring-handler
(ring/router routes)
(swagger-ui/create-swagger-ui-handler {:path "/" :url "/v1/swagger.json"}))
When running locally visiting localhost redirects to the Swagger UI at http://localhost/index.html. However, when deployed at https://api.example.com visiting this URL redirects to http://1.0.0.127/index.html. If I navigate to https://api.example.com/index.html the Swagger UI is properly loaded. Is there a way to specify the host?For now solved it by adding an NGINX reverse proxy with the following statement:
port_in_redirect off;
rewrite ^/$ {REDIRECTION_URL}/index.html permanent;
This way when visiting the root the user is redirected to index.html, which does load Swagger UI properly.
A nicer solution would be figuring out what in the environment makes presumably Swagger UI redirect to http://127.0.0.1:3333/index.html (3333 is the Jetty port), but haven’t found it.