Skip to content

Commit

Permalink
Added X-Forwarded-Proto
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika committed May 14, 2019
1 parent ebe7603 commit d4bd84c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ func startHTTPHandler(state *State) {
return
}

requestedScheme := "http"

if c.Request.TLS != nil {
requestedScheme = "https"
}

c.Request.Header.Set("X-Forwarded-Proto", requestedScheme)

proxyHolder := loc.(*ProxyHolder)

url := *c.Request.URL
Expand All @@ -65,7 +73,7 @@ func startHTTPHandler(state *State) {
return net.Dial("unix", proxyHolder.ProxyTo)
}

if websocket.IsWebSocketUpgrade(c.Request) {
if c.IsWebsocket() {
scheme := "ws"
if url.Scheme == "https" {
scheme = "wss"
Expand Down

0 comments on commit d4bd84c

Please sign in to comment.