Support X-Forwarded-Port.
This commit is contained in:
parent
5313922bb7
commit
3f650bbd11
4 changed files with 11 additions and 4 deletions
6
glide.lock
generated
6
glide.lock
generated
|
@ -1,5 +1,5 @@
|
||||||
hash: b056b388f961ddc3509b19b4546d8dfc70fd50ebd1ca47f2fd2de67bf49ba01e
|
hash: b970da88f72aebed9ac07a31db3f40045de0cd63190a2aae8ce18b55ec3f434a
|
||||||
updated: 2017-08-12T14:15:06.346751095+02:00
|
updated: 2017-08-21T14:15:06.346751095+02:00
|
||||||
imports:
|
imports:
|
||||||
- name: cloud.google.com/go
|
- name: cloud.google.com/go
|
||||||
version: 2e6a95edb1071d750f6d7db777bf66cd2997af6c
|
version: 2e6a95edb1071d750f6d7db777bf66cd2997af6c
|
||||||
|
@ -477,7 +477,7 @@ imports:
|
||||||
- name: github.com/urfave/negroni
|
- name: github.com/urfave/negroni
|
||||||
version: 490e6a555d47ca891a89a150d0c1ef3922dfffe9
|
version: 490e6a555d47ca891a89a150d0c1ef3922dfffe9
|
||||||
- name: github.com/vulcand/oxy
|
- name: github.com/vulcand/oxy
|
||||||
version: d40fb60c9a1620892a6fc146dcdc891fb02bd488
|
version: 3772a8e4408fb033d00a947d340475e116854b1a
|
||||||
repo: https://github.com/containous/oxy.git
|
repo: https://github.com/containous/oxy.git
|
||||||
vcs: git
|
vcs: git
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|
|
@ -12,7 +12,7 @@ import:
|
||||||
- package: github.com/cenk/backoff
|
- package: github.com/cenk/backoff
|
||||||
- package: github.com/containous/flaeg
|
- package: github.com/containous/flaeg
|
||||||
- package: github.com/vulcand/oxy
|
- package: github.com/vulcand/oxy
|
||||||
version: d40fb60c9a1620892a6fc146dcdc891fb02bd488
|
version: 3772a8e4408fb033d00a947d340475e116854b1a
|
||||||
repo: https://github.com/containous/oxy.git
|
repo: https://github.com/containous/oxy.git
|
||||||
vcs: git
|
vcs: git
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|
1
vendor/github.com/vulcand/oxy/forward/headers.go
generated
vendored
1
vendor/github.com/vulcand/oxy/forward/headers.go
generated
vendored
|
@ -4,6 +4,7 @@ const (
|
||||||
XForwardedProto = "X-Forwarded-Proto"
|
XForwardedProto = "X-Forwarded-Proto"
|
||||||
XForwardedFor = "X-Forwarded-For"
|
XForwardedFor = "X-Forwarded-For"
|
||||||
XForwardedHost = "X-Forwarded-Host"
|
XForwardedHost = "X-Forwarded-Host"
|
||||||
|
XForwardedPort = "X-Forwarded-Port"
|
||||||
XForwardedServer = "X-Forwarded-Server"
|
XForwardedServer = "X-Forwarded-Server"
|
||||||
Connection = "Connection"
|
Connection = "Connection"
|
||||||
KeepAlive = "Keep-Alive"
|
KeepAlive = "Keep-Alive"
|
||||||
|
|
6
vendor/github.com/vulcand/oxy/forward/rewrite.go
generated
vendored
6
vendor/github.com/vulcand/oxy/forward/rewrite.go
generated
vendored
|
@ -32,6 +32,12 @@ func (rw *HeaderRewriter) Rewrite(req *http.Request) {
|
||||||
req.Header.Set(XForwardedProto, "http")
|
req.Header.Set(XForwardedProto, "http")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if xfp := req.Header.Get(XForwardedPort); xfp != "" && rw.TrustForwardHeader {
|
||||||
|
req.Header.Set(XForwardedPort, xfp)
|
||||||
|
} else if req.URL.Port() != "" {
|
||||||
|
req.Header.Set(XForwardedPort, req.URL.Port())
|
||||||
|
}
|
||||||
|
|
||||||
if xfh := req.Header.Get(XForwardedHost); xfh != "" && rw.TrustForwardHeader {
|
if xfh := req.Header.Get(XForwardedHost); xfh != "" && rw.TrustForwardHeader {
|
||||||
req.Header.Set(XForwardedHost, xfh)
|
req.Header.Set(XForwardedHost, xfh)
|
||||||
} else if req.Host != "" {
|
} else if req.Host != "" {
|
||||||
|
|
Loading…
Reference in a new issue