1

Let's assume I have a Flask app exposing an endpoint /login and I expose this app behind a reverse proxy (traefik) using the prefix my_app (the proxy has to strip the prefix, however when I use the "try it out" function in swagger ui, it send the request to /my_app/login and my app doesn't know this route).

With this configuration, I can't reach the Swagger UI: if I set url_prefix to my_app in Flask configuration, the documentation will be exposed on /my_app/apidocs but the proxy will strip the first part of the path. I can "cheat" by accessing /my_app/my_app/apidocs but the page doesn't load (css, js etc...) because it will call my_app/flasgger_static/swagger-ui-bundle.js for example (and the my_app will be stripped by the proxy).

Is there any way to set the prefix only when accessing the ressources of the swagger ui?

To recap I would like to have the following endpoints exposed :

  • /login
  • /apidocs
  • /flassger_static/*

but when I'm loading the ui, I would like to perform requests to /my_app/flassger_static/* (similarly to the try it out functionality where I can use basePath

Thanks

Nicolas Mauti
  • 506
  • 3
  • 13
  • related article that helped me https://stackoverflow.com/questions/68848715/flasgger-swagger-apidocs-works-with-localhost-but-not-openshift-you-need-to – Denis Trofimov Jul 13 '22 at 06:55

0 Answers0