Repository navigation
docs: explain running a headless frontend behind a same-origin proxy - #159
Merged
Merged
Conversation
entity
approved these changes
Dec 3, 2026
entity
left a comment
Member
There was a problem hiding this comment.
Looks good to me! The rewrites one is the only one I'd change before merging, the rest are nice to haves
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expands the "One Origin" part of the headless guide for a frontend that passes requests on to Laravel from its own origin, such as a Nuxt or Next.js server route under
/backend, so the browser only ever talks to the site.AcceptandX-Requested-Withon, don't follow redirects, pass every cookie both ways, pass the CSRF headers on, leaveSESSION_DOMAINempty, don't cache. Each rule says what breaks without it, including the followed redirect that leaves the browser on a replaced session ID and surfaces later as a passkey sign in failing with a422.X-Forwarded-For,-Host,-Protoand-Portrather than appending to what the browser sent. A table shows what each one feeds (rate limits, security log, risk signals,redirectURLs, cookie flags), and where the prefix does and doesn't reach. Keyring's emailed links and SSO callback never carry it, but alinkRootUsing()built from the request does.rewrites()entry gives no say over the forwarded headers.Accepton, let h3 follow redirects, took the scheme from the socket (plain HTTP behind a TLS-terminating load balancer), and let a client-sentX-Forwarded-Portthrough.APP_URLor thewebauthnsettings, never the forwarded headers, and the SSO callback lands on the frontend's page. Sign out'sClear-Site-Datanow clears the frontend's own storage too, and the package'sbaseUrlincludes/backend.frontend.md, which suggestedconfigureRoutes({ prefix: 'backend/auth' })for this layout. Theurlprop of the pages emailed links open is a path without the prefix, so those pages would post to the frontend. It now recommendsbaseUrl.Docs only. The h3 behaviour was checked against h3 1.12–1.15's source. The
rewrites()behaviour was checked against the published Next.js 14.2.35 and 16.5.0 source, and the doc describes what a rewrite does with the forwarded headers without naming the library, so it stays true across versions.To test: every relative link and anchor in the changed pages resolves. No docs test reads these pages.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.