-
-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] base_path base_url problems with swagger interface #1117
Comments
I also recently suffered from this issue. Swagger UI requires you to specify a URL where your spec file exists. Connexion automatically populates this with whatever you specify as the In our case, the web server hosts our application on a prefix such as your I managed to solve this by reaching into the internals that connexion uses to determine the URL passed to swagger UI, so in your case:
A way to do this properly is for connexion to support a swagger-UI-specific base path. |
Actually in 2.5.1 there is added support for path-altering reverse proxies. There's an example here: https://github.com/zalando/connexion/tree/master/examples/openapi3/reverseproxy |
@dtkav
It works as long I use it locally. The swagger url in the web ui is wrong because it is missing testproj01. It works beacause PrefixMiddleware takes care of this. It is not working if I use it behind a reverse proxy. This is the relevant part in the proxy configuration:
|
@Norbo11 |
Hello,
I am following these tutorials for a small test project:
https://realpython.com/flask-connexion-rest-api/
https://stackoverflow.com/questions/18967441/add-a-prefix-to-all-flask-routes
My project requires a base_url. In this case testproj01 .
My data endpoint is available as: http://0.0.0.0:5000/testproj01/dyna/people This is ok.
The non swagger/connexion endpoint http://0.0.0.0:5000/testproj01/ is ok too.
The swagger ui is available as http://0.0.0.0:5000/testproj01/dyna/ui/ and is working but it tries to load the json file from http://0.0.0.0:5000/dyna/swagger.json and that is not working.
The base_url is missing in the link. If I change the link manually to: http://0.0.0.0:5000/testproj01/dyna/swagger.json I can see the endpoint deffinitions.
How can I tell connexion to also introduce the base_url into this request?
This is the code I am using:
The text was updated successfully, but these errors were encountered: