Is there an existing issue for this?
Current Behavior
If a same-origin request for example.com comes in with a valid token, and is then reverse proxied to backend.acme.example, it will be rejected by the new Origin header check, because the Host header was rewritten by the reverse proxy.
|
if requestURL.Host == "" { |
|
requestURL.Host = r.Host |
|
} |
|
if !sameOrigin(&requestURL, parsedOrigin) && !slices.Contains(cs.opts.TrustedOrigins, parsedOrigin.Host) { |
|
r = envError(r, ErrBadOrigin) |
|
cs.opts.ErrorHandler.ServeHTTP(w, r) |
|
return |
|
} |
Expected Behavior
Same-origin requests should be allowed even if the Host header is modified.
They can be reliably detected with the Sec-Fetch-Site header.
Steps To Reproduce
N/A
Anything else?
N/A