Skip to content

fix: mark cookies Secure behind a TLS-terminating proxy - #764

Merged
harryjackson merged 2 commits into
masterfrom
security/secure-cookies
Nov 12, 2026
Merged

harryjackson merged 2 commits into
masterfrom
security/secure-cookies

Conversation

@harryjackson

Copy link
Copy Markdown
Collaborator

Cookies only got the Secure flag when the WSGI scheme was https, which is never the case behind a proxy that terminates TLS. The Digest auth cookies never got it at all. Every cookie now gets Secure when the original request was HTTPS, using the same X-Forwarded-Proto / X-Forwarded-Protocol / X-Forwarded-Ssl check as the url field. This matches httpbin.org.

Generated with Claude Code

harryjackson and others added 2 commits November 12, 2026 13:45
Cookies were marked Secure only when the WSGI scheme was https, which is
never true behind a proxy that terminates TLS, and the Digest auth
cookies never were. Every cookie now gets Secure when the original
request was HTTPS, judged as the url field is: X-Forwarded-Proto,
X-Forwarded-Protocol, X-Forwarded-Ssl: on, then the WSGI scheme. That
matches httpbin.org.

Co-Authored-By: Claude <noreply@anthropic.com>
@harryjackson
harryjackson merged commit 0a692d4 into master Nov 12, 2026
14 checks passed
@harryjackson
harryjackson deleted the security/secure-cookies branch November 12, 2026 22:00
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.

1 participant