diff options
Diffstat (limited to 'util/http.go')
-rw-r--r-- | util/http.go | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/util/http.go b/util/http.go deleted file mode 100644 index 31cd94d..0000000 --- a/util/http.go +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | package util | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | "net/http" | ||
6 | "net/url" | ||
7 | ) | ||
8 | |||
9 | func MakeURL(r *http.Request, path string, subs ...interface{}) *url.URL { | ||
10 | scheme := "https" | ||
11 | if r.TLS == nil { | ||
12 | scheme = "http" | ||
13 | } | ||
14 | |||
15 | // Always defer to whatever the proxy told us it was doing because this | ||
16 | // could be a mullet-VIP in either direction. | ||
17 | if fwProto := r.Header.Get("X-Forwarded-Proto"); fwProto != "" { | ||
18 | scheme = fwProto | ||
19 | } | ||
20 | |||
21 | return &url.URL{ | ||
22 | Scheme: scheme, | ||
23 | Host: r.Host, | ||
24 | Path: fmt.Sprintf(path, subs...), | ||
25 | } | ||
26 | } | ||