Description
Is there an existing issue for this?
- I have searched the existing issues
The issue
It seems like opt.TrustedOrigins
is being required to set even though the request does come from the same origin
Current Behavior
The function sameOrigin
is comparing a.Scheme == b.Scheme
and a.Host == b.Host
Lines 157 to 158 in 9dd6af1
The handler for the CSRF check is using this function to compare r.URL
vs r.Header.Get("Origin")
here
Lines 288 to 289 in 9dd6af1
The issue is that requestURL.Schema
is set to https
even when request origin is http because isPlainText
in local environment is false
Lines 271 to 272 in 9dd6af1
The current fix is to add localhost:8080
as opt.TrustedOrigins
but in this case the origin is the same, it shouldn't be required.
Expected Behavior
Requests from the same origin (host + scheme) should not require manually adding entries to opt.TrustedOrigins
.
Steps To Reproduce
No response
Anything else?
Solutions seems to be to update the logic to correctly detect plaintext (http) requests in local/dev environments or improve how isPlaintext is set/detected by default.