mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-21 16:01:22 +02:00
feat(ReverseProxy): add SSL/TLS configuration options and build TLS config method
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package route
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
@@ -44,10 +43,12 @@ func NewReverseProxyRoute(base *Route) (*ReveseProxyRoute, gperr.Error) {
|
||||
trans = a.Transport()
|
||||
proxyURL = nettypes.NewURL(agent.HTTPProxyURL)
|
||||
} else {
|
||||
trans = gphttp.NewTransport()
|
||||
if httpConfig.NoTLSVerify {
|
||||
trans.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //nolint:gosec
|
||||
tlsConfig, err := httpConfig.BuildTLSConfig(base.ProxyURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
trans = gphttp.NewTransportWithTLSConfig(tlsConfig)
|
||||
if httpConfig.ResponseHeaderTimeout > 0 {
|
||||
trans.ResponseHeaderTimeout = httpConfig.ResponseHeaderTimeout
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user