X-Forwarded-Proto must not skip the redirection.
This commit is contained in:
parent
3fd330c2fb
commit
42a8d84a1f
3 changed files with 48 additions and 17 deletions
|
@ -132,19 +132,13 @@ func rawURL(req *http.Request) string {
|
|||
uri = match[4]
|
||||
}
|
||||
|
||||
if req.TLS != nil || isXForwardedHTTPS(req) {
|
||||
if req.TLS != nil {
|
||||
scheme = "https"
|
||||
}
|
||||
|
||||
return strings.Join([]string{scheme, "://", host, port, uri}, "")
|
||||
}
|
||||
|
||||
func isXForwardedHTTPS(request *http.Request) bool {
|
||||
xForwardedProto := request.Header.Get("X-Forwarded-Proto")
|
||||
|
||||
return len(xForwardedProto) > 0 && xForwardedProto == "https"
|
||||
}
|
||||
|
||||
func applyString(in string, out io.Writer, req *http.Request) error {
|
||||
t, err := template.New("t").Parse(in)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue