This PR adds functionality to allow Gitea to sit behind an HAProxy and HAProxy protocolled connections directly. Fix #7508
Showing the changes to cmd/web_https.go (1 of 15 files). Show all
Unified · Split
| @@ -129,14 +129,14 @@ var ( · 128 unmodified lines | ||
| 129 | 129 | defaultCiphersChaChaFirst = append(defaultCiphersChaCha, defaultCiphersAES...) |
| 130 | 130 | ) |
| 131 | 131 | |
| 132 | −// runHTTPs listens on the provided network address and then calls | |
| 132 | +// runHTTPS listens on the provided network address and then calls | |
| 133 | 133 | // Serve to handle requests on incoming TLS connections. |
| 134 | 134 | // |
| 135 | 135 | // Filenames containing a certificate and matching private key for the server must |
| 136 | 136 | // be provided. If the certificate is signed by a certificate authority, the |
| 137 | 137 | // certFile should be the concatenation of the server's certificate followed by the |
| 138 | 138 | // CA's certificate. |
| 139 | −func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handler) error { | |
| 139 | +func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handler, useProxyProtocol, proxyProtocolTLSBridging bool) error { | |
| 140 | 140 | tlsConfig := &tls.Config{} |
| 141 | 141 | if tlsConfig.NextProtos == nil { |
| 142 | 142 | tlsConfig.NextProtos = []string{"h2", "http/1.1"} |
| @@ -184,9 +184,9 @@ func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handle · 41 unmodified lines | ||
| 184 | 184 | return err |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | − return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m) | |
| 187 | + return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m, useProxyProtocol, proxyProtocolTLSBridging) | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | −func runHTTPSWithTLSConfig(network, listenAddr, name string, tlsConfig *tls.Config, m http.Handler) error { | |
| 191 | − return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m) | |
| 190 | +func runHTTPSWithTLSConfig(network, listenAddr, name string, tlsConfig *tls.Config, m http.Handler, useProxyProtocol, proxyProtocolTLSBridging bool) error { | |
| 191 | + return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m, useProxyProtocol, proxyProtocolTLSBridging) | |
| 192 | 192 | } |