Skip to content

csrf: treat Secure(false) as plaintext for Origin checks - #212

Open
team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:fix-secure-false-http-origin
Open

team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:fix-secure-false-http-origin

Conversation

@team-humaki

Copy link
Copy Markdown

Fixes #190

csrf.Secure(false) is the documented local-dev flag, but Origin checks still rewrote the request URL to https unless the caller also wrapped the request in PlaintextHTTPRequest. POSTs from http://localhost:... then failed same-origin.

Secure(false) now sets the plaintext path. PlaintextHTTPRequest still works when Secure stays true behind a cleartext proxy.

Local HTTP Origin was compared against a rewritten https request URL,
so csrf.Secure(false) still 403'd localhost POSTs. Issue gorilla#190.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Forbidden - Invalid Origin in localhost

1 participant