Commit a75e1c5
authored
Enable redirection of HTTP requests to HTTPS (#253)
Using Django's `SECURE_SSL_REDIRECT`:
https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-SECURE_SSL_REDIRECT
Also configures gunicorn's `forwarded_allow_ips` setting to `"*"` so that
gunicorn trusts the `X-Forwarded-Proto` header set by the Heroku Router during
TLS termination, to ensure that HTTPS requests are correctly marked as secure in
the WSGI metadata passed to the WSGI app (in this case, Django). See:
https://docs.gunicorn.org/en/stable/settings.html#forwarded-allow-ips
https://devcenter.heroku.com/articles/http-routing#heroku-headers
(Whilst the classic Python buildpack already configures this by setting the env
var `FORWARDED_ALLOW_IPS`, the Python CNB doesn't yet do so, and it's
clearer to have the config explicitly set in the app source.)
GUS-W-17482732.1 parent a288ab1 commit a75e1c5
2 files changed
+24
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
0 commit comments