Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Add X-Forwarded-Proto header
Browse files Browse the repository at this point in the history
Guess protocol from redirect-url scheme if present, or from
cookie-secure flag value.

closes bitly#171
  • Loading branch information
Artyom Pervukhin authored and joejulian committed Mar 3, 2018
1 parent c9292ff commit 6c49db8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,14 @@ func (p *OAuthProxy) Authenticate(rw http.ResponseWriter, req *http.Request) int
} else {
rw.Header().Set("GAP-Auth", session.Email)
}
switch {
case p.redirectURL.Scheme != "":
req.Header.Set("X-Forwarded-Proto", p.redirectURL.Scheme)
case p.CookieSecure:
req.Header.Set("X-Forwarded-Proto", "https")
default:
req.Header.Set("X-Forwarded-Proto", "http")
}
return http.StatusAccepted
}

Expand Down

0 comments on commit 6c49db8

Please sign in to comment.