Skip to content

Commit b5d1f6a

Browse files
committed
Move to workspaceapps.go
1 parent 4696bf9 commit b5d1f6a

File tree

5 files changed

+253
-271
lines changed

5 files changed

+253
-271
lines changed

coderd/httpapi/host.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package httpapi
2+
3+
import "net/http"
4+
5+
const (
6+
// XForwardedHostHeader is a header used by proxies to indicate the
7+
// original host of the request.
8+
XForwardedHostHeader = "X-Forwarded-Host"
9+
)
10+
11+
// RequestHost returns the name of the host from the request. It prioritizes
12+
// 'X-Forwarded-Host' over r.Host since most requests are being proxied.
13+
func RequestHost(r *http.Request) string {
14+
host := r.Header.Get(XForwardedHostHeader)
15+
if host != "" {
16+
return host
17+
}
18+
19+
return r.Host
20+
}

coderd/subdomain.go

Lines changed: 0 additions & 155 deletions
This file was deleted.

coderd/subdomain_test.go

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)