Skip to content

Feature/swagger ui behind proxy#596

Open
adroffner wants to merge 4 commits intonoirbizarre:masterfrom
adroffner:feature/swagger-ui-behind-proxy
Open

Feature/swagger ui behind proxy#596
adroffner wants to merge 4 commits intonoirbizarre:masterfrom
adroffner:feature/swagger-ui-behind-proxy

Conversation

@adroffner
Copy link

This branch adds a behind_proxy=True keyword parameter to the flask_restplus.api.Api(..., behind_proxy=True) object. Many users need a reverse proxy like nginx to serve the REST API. In my case, I had to place the server inside a kubernetes pod & keep its port number.

I added appropriate unit tests to the test_api.py file. It considers both cases when behind_proxy is either True or False. I assume that SERVER_NAME is set & has a defined port.

OTHER ISSUES: I did not want to fix these in this branch & make it change too much

  • I had to pip install wheel to make the invoke dist work, which is not listed in the requirements directory.
  • I had to run invoke assets before invoke dist so that the Swagger UI javascript gets into the wheel
  • invoke qa shows many mccabe complexity violations (C901 flake8 warnings) that stop the build

The C901 complexity warnings mean no one can just run inv all to complete a build :(

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 96.852% when pulling feab0fd on adroffner:feature/swagger-ui-behind-proxy into a8f3582 on noirbizarre:master.

@michaelbukachi
Copy link

I really hope this pull request is merged. There's hack I keep copying from project to project just to apps work behind proxies.😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants