Skip to content

Route.Request helper for proxied origin (#94) - #100

Draft
nounder wants to merge 1 commit into
mainfrom
cursor/fix-94-request-origin-c215
Draft

Route.Request helper for proxied origin (#94)#100
nounder wants to merge 1 commit into
mainfrom
cursor/fix-94-request-origin-c215

Conversation

@nounder

@nounder nounder commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Fixes #94

Summary

Adds a helper to compute the request origin that respects reverse-proxy forwarded headers (X-Forwarded-Host / X-Forwarded-Proto).

Changes

  • Route.requestOrigin(request) pure helper
  • Route.Request.origin Effect for use inside handlers
  • Wire CSRF protection to use the helper so same-origin checks work behind proxies

Test plan

  • bun test test/Route.test.tsx test/experimental/CsrfProtection.test.ts
Open in Web Open in Cursor 

Resolves the request origin honoring X-Forwarded-Host/X-Forwarded-Proto
so the app reports the public origin when running behind a reverse
proxy, falling back to the request URL otherwise. Exposed both as a
pure function (Route.requestOrigin) and as Route.Request.origin, an
Effect that reads the current request from context.

Wires it into CsrfProtection's origin-matching so same-origin checks
also work correctly behind a reverse proxy.

Closes #94

Co-authored-by: Ralph Gutkowski <nounder@users.noreply.github.com>
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.

Route.Request helper for proxied origin

2 participants