diff options
author | zeripath <art27@cantab.net> | 2022-08-21 19:20:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 19:20:43 +0100 |
commit | 943753f560fab8bb01946618b16c694bc2032827 (patch) | |
tree | d4faa0f8bde73d61ee00d7252ceb79f8334088b1 /cmd/web_graceful.go | |
parent | 0b4c166e8a90beeb1e71ee2fc16b3a240517c82d (diff) | |
download | gitea-943753f560fab8bb01946618b16c694bc2032827.tar.gz gitea-943753f560fab8bb01946618b16c694bc2032827.zip |
Support Proxy protocol (#12527)
This PR adds functionality to allow Gitea to sit behind an
HAProxy and HAProxy protocolled connections directly.
Fix #7508
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'cmd/web_graceful.go')
-rw-r--r-- | cmd/web_graceful.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/web_graceful.go b/cmd/web_graceful.go index 1618208c55..ba88cc59c2 100644 --- a/cmd/web_graceful.go +++ b/cmd/web_graceful.go @@ -15,8 +15,8 @@ import ( "code.gitea.io/gitea/modules/setting" ) -func runHTTP(network, listenAddr, name string, m http.Handler) error { - return graceful.HTTPListenAndServe(network, listenAddr, name, m) +func runHTTP(network, listenAddr, name string, m http.Handler, useProxyProtocol bool) error { + return graceful.HTTPListenAndServe(network, listenAddr, name, m, useProxyProtocol) } // NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector @@ -36,7 +36,7 @@ func NoInstallListener() { graceful.GetManager().InformCleanup() } -func runFCGI(network, listenAddr, name string, m http.Handler) error { +func runFCGI(network, listenAddr, name string, m http.Handler, useProxyProtocol bool) error { // This needs to handle stdin as fcgi point fcgiServer := graceful.NewServer(network, listenAddr, name) @@ -47,7 +47,7 @@ func runFCGI(network, listenAddr, name string, m http.Handler) error { } m.ServeHTTP(resp, req) })) - }) + }, useProxyProtocol) if err != nil { log.Fatal("Failed to start FCGI main server: %v", err) } |