mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 06:55:53 +03:00
[PR #597] [CLOSED] Enable Django setting CSRF_TRUSTED_SOURCES #997
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#997
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/healthchecks/healthchecks/pull/597
Author: @jormaj
Created: 1/13/2022
Status: ❌ Closed
Base:
master← Head:CSRF_TRUSTED_SOURCES📝 Commits (2)
0da8c97Enable Django setting CSRF_TRUSTED_SOURCES28402dbproperly handle variable not set📊 Changes
2 files changed (+4 additions, -0 deletions)
View changed files
📝
docker/.env(+1 -0)📝
hc/settings.py(+3 -0)📄 Description
On my dockerized setup (using an Nginx reverse proxy) I got CSRF errors since the move to Django 4 (also see https://docs.djangoproject.com/en/4.0/ref/settings/#csrf-trusted-origins).
After some investiation I found out that this is caused by the fact that the proxy is ssl terminating (ie the proxy is reached through https), and the docker container is running on localhost (ie http).
The Django csrf check
looks at the scheme of the request, so there's a mismatch between the scheme + host and the origin (ie http:// vs https://).
A workaround is to use CSRF_TRUSTED_SOURCES and set the origin there as a trusted origin.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.