@marcel91200 / caddy Mirror · read-only / commits / f29023bf
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

reverseproxy: Minor tweaks

We'll need that context in v2.1 when the transport can manage its own client certificates; see #3198

Matthew Holt committed Apr 9, 2020 at 13:22 UTC f29023bf8f7de84faf0db8233b0c4b3b4ce74e93
2 files changed +4 -4
modules/caddyhttp/reverseproxy/command.go
+1 -1
@@ -121,7 +121,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
121 urlHost := fromURL.Hostname()
122 if urlHost != "" {
123 route.MatcherSetsRaw = []caddy.ModuleMap{
124 - caddy.ModuleMap{
124 + {
125 "host": caddyconfig.JSON(caddyhttp.MatchHost{urlHost}, nil),
126 },
127 }
modules/caddyhttp/reverseproxy/httptransport.go
+3 -3
@@ -99,12 +99,12 @@ func (HTTPTransport) CaddyModule() caddy.ModuleInfo {
99
100 // Provision sets up h.Transport with a *http.Transport
101 // that is ready to use.
102 -func (h *HTTPTransport) Provision(_ caddy.Context) error {
102 +func (h *HTTPTransport) Provision(ctx caddy.Context) error {
103 if len(h.Versions) == 0 {
104 h.Versions = []string{"1.1", "2"}
105 }
106
107 - rt, err := h.NewTransport()
107 + rt, err := h.NewTransport(ctx)
108 if err != nil {
109 return err
110 }
@@ -115,7 +115,7 @@ func (h *HTTPTransport) Provision(_ caddy.Context) error {
115
116 // NewTransport builds a standard-lib-compatible
117 // http.Transport value from h.
118 -func (h *HTTPTransport) NewTransport() (*http.Transport, error) {
118 +func (h *HTTPTransport) NewTransport(_ caddy.Context) (*http.Transport, error) {
119 dialer := &net.Dialer{
120 Timeout: time.Duration(h.DialTimeout),
121 FallbackDelay: time.Duration(h.FallbackDelay),