Strict-Transport-Security when PLAINTEXT_URL is https #19

Merged
backmeupplz merged 2 commits from board/980-504af9 into main 2026-11-27 20:58:31 +00:00
Owner

When any PLAINTEXT_URL entry starts with https://, every response now carries Strict-Transport-Security: max-age=31536000, so browsers that have seen the server once keep using HTTPS for it. Without an https address nothing changes.

  • Config::hsts, set in main.rs from plaintext_server::https_url, which reads the raw PLAINTEXT_URL before server_host drops the scheme (case-insensitive, any comma-separated entry).
  • The header is added by the outermost layer of the router, so 404s and body-limit refusals carry it too.
  • README: the PLAINTEXT_URL row mentions it.

Tests: https_urls (unit, the URL check) and strict_transport_security (end to end: /health 200, an unknown path 404 and an oversized signup 413 carry the header with an https URL and lack it without one). cargo clippy --all-targets -D warnings and cargo test --locked pass locally.

🤖 Generated with Claude Code

When any `PLAINTEXT_URL` entry starts with `https://`, every response now carries `Strict-Transport-Security: max-age=31536000`, so browsers that have seen the server once keep using HTTPS for it. Without an https address nothing changes. - `Config::hsts`, set in `main.rs` from `plaintext_server::https_url`, which reads the raw `PLAINTEXT_URL` before `server_host` drops the scheme (case-insensitive, any comma-separated entry). - The header is added by the outermost layer of the router, so 404s and body-limit refusals carry it too. - README: the `PLAINTEXT_URL` row mentions it. Tests: `https_urls` (unit, the URL check) and `strict_transport_security` (end to end: `/health` 200, an unknown path 404 and an oversized signup 413 carry the header with an https URL and lack it without one). `cargo clippy --all-targets -D warnings` and `cargo test --locked` pass locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Server sends Strict-Transport-Security when PLAINTEXT_URL is https
All checks were successful
CI / wasm (pull_request) Successful in 1m27s
CI / check (pull_request) Successful in 1m59s
05e87f6510
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DESIGN: note Strict-Transport-Security
All checks were successful
CI / wasm (pull_request) Successful in 1m40s
CI / check (pull_request) Successful in 2m10s
d63de7392e
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
backmeupplz deleted branch board/980-504af9 2026-11-27 20:58:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
backmeupplz/plaintext!19
No description provided.