-
-
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
Serve correct openapi spec basepath when path is altered by reverse-proxy #823
Conversation
That fixes the Explore bar nicely so the spec is loaded into the UI Console. That also sets the link to the spec file correctly. The |
note: this doesn't yet work with aiohttp |
1cd4b63
to
7d1ad29
Compare
hey @bhechinger - can you try out the latest example, and let me know if it is working for you? |
The build is broken because of #844 |
2ac89dd
to
720ed84
Compare
I think I have this pretty much where I want it. It could be a bit more DRY. Potential future work could be to actually add the reverse proxy code to I think for now it's probably best to leave it as an example for the user to learn about and adapt to their use case. |
0a2d2bb
to
12657a2
Compare
I'm stuck on a single aiohttp test in python 3.4, where it seems to think that aiohttp is installed after calling sys.modules.pop("aiohttp"). |
Not reproduced on my side either, but you can try another strategy with mocker:
|
988009f
to
75438f2
Compare
@Jyhess thanks for your help. I was able to sort it out by using mock. |
@jmcs can you take a look at this one please? |
75438f2
to
abf7e55
Compare
|
||
.. code-block:: bash | ||
|
||
$ sudo pip3 install --upgrade connexion[swagger-ui] # install Connexion from PyPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to specify extra dependency:
sudo pip3 install --upgrade connexion[swagger-ui] aiohttp-remotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! oops
requirements-aiohttp.txt
Outdated
@@ -1,4 +1,5 @@ | |||
aiohttp>=2.2.5,<3.5.2 | |||
aiohttp-remotes>=0.1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should not be part of project dependencies when it is used only in an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but it is needed for the unit tests. I'll add it to setup.py under test-requres for > python 3.5.2
abf7e55
to
9528785
Compare
Hey @hjacobs if you find some time - these changes will enable people to use connexion behind a path-altering reverse proxy (like AWS API Gateway). |
8c2caf9
to
dec7237
Compare
@hjacobs can you please take a look at this fix for path-altering reverse proxies? |
@rafaelcaricio are you happy with the changes to address your comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great and needs to be merged. 👍 I have a few minor nitpicks, but it can be merged without addressing them.
dec7237
to
26249b9
Compare
1b04d30
to
dd5f29b
Compare
@hjacobs can you please have a look? |
👍 |
Fixes #820
Fixes #392
Fixes #527
Changes proposed in this pull request:
url_for
basePath
orservers
block to include the reversed api pathurl_for
Thanks to @Jyhess for the collaboration, tests, and review!