-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use SCRIPT_NAME
instead of route prefix & configure gunicorn for secure scheme header
#24
Conversation
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.
Thanks, looks good to me 👍
…secure scheme header The path prefix is now set by the deployment using the WSGI SCRIPT_NAME environment variable. Also configure gunicorn to use secure scheme header which allow us to get rid of the middleware. This settings is needed in order to set the correct http proto in generated urls in responses. Change the default ALLOWED_ORIGIN to allow everything.
dae804b
to
0954319
Compare
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.
@ltshb thanks for the investigation
@@ -43,6 +43,7 @@ PIP_FILE_LOCK = Pipfile.lock | |||
# default configuration | |||
ENV_FILE ?= .env.default | |||
HTTP_PORT ?= 5000 | |||
ROUTE_PREFIX ?= /api/kml |
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.
WHY not using SCRIPT_NAME allover?
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.
@rebert What do you mean exactly ? We cannot use the SCRIPT_NAME with the Flask development server, only with gunicorn.
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.
👍 Thanks
README.md
Outdated
| DEV | [https://sys-publid.dev.bgdi.ch/api/kml/](https://sys-publid.dev.bgdi.ch/api/kml/) | | ||
| INT | [https://sys-publid.int.bgdi.ch/api/kml/](https://sys-publid.int.bgdi.ch/api/kml/) | |
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.
Small typing error, public
SCRIPT_NAME
instead of route prefix & configure gunicorn for secure scheme header
The path prefix is now set by the deployment using the WSGI SCRIPT_NAME
environment variable. The change in this paradigma come from this post: https://dlukes.github.io/flask-wsgi-url-prefix.html
Also configure gunicorn to use secure scheme header which allow us to
get rid of the middleware. This settings is required in order to have the correct proto in generated urls in responses.
Change the default ALLOWED_ORIGIN to allow everything.