Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorVladimir Shushlin <vshushlin@gitlab.com>2022-01-24 15:59:52 +0300
committerVladimir Shushlin <vshushlin@gitlab.com>2022-01-24 15:59:52 +0300
commit136471e8d5a582236fb0f9565da3b0114a048b1e (patch)
tree581a920d824be61b856e341e66a15fee7fa24458 /app.go
parent88656e8f55e74ea5d7adf703e36dac23726a139b (diff)
parent9b0053ad677e091c625e81b55932304e022e8794 (diff)
Merge branch 'fix/xforward-duplicate' into 'master'
fix: remove duplicate xForwardedHost handler See merge request gitlab-org/gitlab-pages!641
Diffstat (limited to 'app.go')
-rw-r--r--app.go17
1 files changed, 1 insertions, 16 deletions
diff --git a/app.go b/app.go
index 19bcedcd..da40c5f1 100644
--- a/app.go
+++ b/app.go
@@ -44,10 +44,6 @@ import (
"gitlab.com/gitlab-org/gitlab-pages/metrics"
)
-const (
- xForwardedHost = "X-Forwarded-Host"
-)
-
var (
corsHandler = cors.New(cors.Options{AllowedMethods: []string{http.MethodGet, http.MethodHead}})
)
@@ -215,17 +211,6 @@ func (a *theApp) httpInitialMiddleware(handler http.Handler) http.Handler {
})
}
-// proxyInitialMiddleware sets up proxy requests
-func (a *theApp) proxyInitialMiddleware(handler http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if forwardedHost := r.Header.Get(xForwardedHost); forwardedHost != "" {
- r.Host = forwardedHost
- }
-
- handler.ServeHTTP(w, r)
- })
-}
-
// setRequestScheme will update r.URL.Scheme if empty based on r.TLS
func setRequestScheme(r *http.Request) *http.Request {
if r.URL.Scheme == request.SchemeHTTPS || r.TLS != nil {
@@ -309,7 +294,7 @@ func (a *theApp) Run() {
log.WithError(err).Fatal("Unable to configure pipeline")
}
- proxyHandler := a.proxyInitialMiddleware(ghandlers.ProxyHeaders(commonHandlerPipeline))
+ proxyHandler := ghandlers.ProxyHeaders(commonHandlerPipeline)
httpHandler := a.httpInitialMiddleware(commonHandlerPipeline)