Skip to content
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

Merged
merged 3 commits into from
Nov 3, 2021

Conversation

ltshb
Copy link
Contributor

@ltshb ltshb commented Nov 2, 2021

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.

@ltshb ltshb changed the title Feature-route-prefix Removed the route prefix and use SCRIPT_NAME, configure gunicorn for secure scheme header Nov 2, 2021
Copy link
Member

@hansmannj hansmannj left a 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.
@ltshb ltshb force-pushed the feature-route-prefix branch from dae804b to 0954319 Compare November 3, 2021 04:52
Copy link
Contributor

@rebert rebert left a 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
Copy link
Contributor

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?

Copy link
Contributor Author

@ltshb ltshb Nov 3, 2021

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.

Copy link
Contributor

@IsabelleBzr IsabelleBzr left a 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
Comment on lines 33 to 34
| 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/) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typing error, public

@ltshb ltshb changed the title Removed the route prefix and use SCRIPT_NAME, configure gunicorn for secure scheme header Use SCRIPT_NAME instead of route prefix & configure gunicorn for secure scheme header Nov 3, 2021
@ltshb ltshb merged commit 1f56c10 into develop Nov 3, 2021
@ltshb ltshb deleted the feature-route-prefix branch November 3, 2021 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants