Skip to content

feat(routing): add opt-in HTTPS redirects - #625

Merged
Brooooooklyn merged 3 commits into
mainfrom
fix/http-to-https-redirects
Oct 29, 2026
Merged

Brooooooklyn merged 3 commits into
mainfrom
fix/http-to-https-redirects

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

A lot of deployed apps should be https by default. This is not easy to set up via the Void config (only a custom middleware would do the tricks).

This PR adds a routing.alwaysUseHttps as a per-app opt-in

  • true redirects HTTP to HTTPS with a permanent 308, preserving the path, query string, and request method.
  • false keeps things aa they are rn.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-http-to-https-redirects-void-cloud.voidzero-docs.workers.dev (commit 99c9f2f)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://00bc649d-void-cloud.voidzero-docs.workers.dev 99c9f2f 2026-10-29T06:26:38.889Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://086621b3-void-cloud.voidzero-docs.workers.dev 06fa762 2026-10-27T18:52:20.556Z Visit the dashboard ↗
  • Build: In progress 🔵

View logs ↗
c29fe76 2026-10-27T18:15:28.690Z View logs ↗

@TheAlexLichter TheAlexLichter changed the title fix(platform): redirect HTTP app requests to HTTPS feat(routing): add opt-in HTTPS redirects Oct 27, 2026
@TheAlexLichter
TheAlexLichter marked this pull request as ready for review October 27, 2026 19:03
@TheAlexLichter

Copy link
Copy Markdown
Member Author

IMO this should be the default but would be a breaking change 😮‍💨

TheAlexLichter and others added 3 commits October 29, 2026 14:19
- Redirect in createWorkerFetch before the ISR cache, so cached pages are
  never served over HTTP. In-process server fetch and cron jobs call the app
  directly and no longer get a 308.
- Reject alwaysUseHttps with node/bun/deno targets, which never redirect.
- Stop native Cloudflare deploys of frameworks that own their Worker when
  alwaysUseHttps is set; static framework builds still redirect.
- Keep the hashed asset Worker bypass so asset requests stay free on
  Workers Free.
- Replace the loopback regex with a small parser.
- Document the behaviour in the redirects guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Brooooooklyn

Copy link
Copy Markdown
Member

@codex review

@Brooooooklyn
Brooooooklyn force-pushed the fix/http-to-https-redirects branch from 06fa762 to 99c9f2f Compare October 29, 2026 06:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T06:26:12.492523Z 99c9f2f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 99c9f2f80d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2

fengmk2 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Would this be considered a bug fix? Other than in local development mode, should applications in any deployment state default to HTTPS?

@Brooooooklyn

Copy link
Copy Markdown
Member

@fengmk2 yes, I would consider this is a bug fix

@Brooooooklyn
Brooooooklyn merged commit 63b0d91 into main Oct 29, 2026
19 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/http-to-https-redirects branch October 29, 2026 06:53
@mdong1909

Copy link
Copy Markdown
Contributor

Does this mean we can move .rs & .cloud sites to https?

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.

4 participants