Skip to content

Self-host: pass the proxy's X-Forwarded-Proto through to the product - #2288

Closed
jossephus wants to merge 1 commit into
UsefulSoftwareCo:v2from
jossephus:fix/self-host-forwarded-proto
Closed

jossephus wants to merge 1 commit into
UsefulSoftwareCo:v2from
jossephus:fix/self-host-forwarded-proto

Conversation

@jossephus

@jossephus jossephus commented Oct 14, 2026 •

Copy link
Copy Markdown

Behind an HTTPS reverse proxy, every POST /api/dashboard/batch on self-host answers an empty 403 and dashboard panels show "Unable to complete this request" (#2199). Reproduced on 2.0.0-beta.17 behind Caddy: 26 of 26 batch requests refused in an hour, all same-origin.

The Go host proxies to workerd over plain http, and ReverseProxy's Rewrite drops the outer proxy's X-Forwarded-Proto, so the product rebuilds http://<host> and sameOrigin in batch-host.ts refuses the browser's https:// Origin.

This passes the proxy's X-Forwarded-Proto (http or https) through to the product, instead of deriving the scheme from BETTER_AUTH_URL as #2251 does. go vet and go test ./... in apps/hosted/self-host/native pass.

dashboard-read-batches.spec.ts
self-host-onboarding.spec.ts

@jossephus
jossephus force-pushed the fix/self-host-forwarded-proto branch from c101be2 to ac7fa59 Compare October 14, 2026 06:07
The Go host proxies to workerd over plain http, and ReverseProxy's Rewrite drops
X-Forwarded-Proto, so the product saw http:// request URLs even when browsers used
https://. The dashboard batch endpoint compares Origin with that URL, so behind an
HTTPS proxy every POST /api/dashboard/batch answered 403 and dashboard panels showed
"Unable to complete this request". The Go host now passes the proxy's
X-Forwarded-Proto (http or https) through.
@jossephus
jossephus force-pushed the fix/self-host-forwarded-proto branch from ac7fa59 to 8baa0fc Compare October 14, 2026 06:09
@jossephus jossephus changed the title Self-host: forward the public scheme to the product behind a TLS proxy Self-host: pass the proxy's X-Forwarded-Proto through to the product Oct 14, 2026
@jossephus

Copy link
Copy Markdown
Author

Closing as a duplicate of #2251 and #2250, which fix #2199. Leaving the passthrough variant here for reference: it reflects the scheme the outer proxy saw on each request rather than the one configured in BETTER_AUTH_URL. Confirmed the bug on 2.0.0-beta.17 behind Caddy.

@jossephus jossephus closed this Oct 14, 2026
@RhysSullivan

Copy link
Copy Markdown
Collaborator

Thanks @jossephus for the report and the ping. The fix from #2250 is on main now, with you credited as a co-author. It ships in the next beta image, which I'm cutting now.

Sent from my Claude

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.

2 participants