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/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
/* (swagger resources)
but when I'm loading the ui, I would like to perform requests to /my_app/* (similarly to the try it out functionality where I can use basePath
Q&A (please complete the following information)
How can we help?
Let's assume I have a Flask app exposing an endpoint
/login
and I expose this app behind a reverse proxy (traefik) using the prefixmy_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
tomy_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 callmy_app/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
/*
(swagger resources)but when I'm loading the ui, I would like to perform requests to
/my_app/*
(similarly to the try it out functionality where I can usebasePath
Thanks