HTTPTransport is essentially a configuration wrapper for http.Transport. It defines a JSON structure useful when configuring the HTTP transport for Caddy's reverse proxy. It builds its http.Transport at Provision.
| 53 | // It defines a JSON structure useful when configuring the HTTP transport |
| 54 | // for Caddy's reverse proxy. It builds its http.Transport at Provision. |
| 55 | type HTTPTransport struct { |
| 56 | // TODO: It's possible that other transports (like fastcgi) might be |
| 57 | // able to borrow/use at least some of these config fields; if so, |
| 58 | // maybe move them into a type called CommonTransport and embed it? |
| 59 | |
| 60 | // Configures the DNS resolver used to resolve the IP address of upstream hostnames. |
| 61 | Resolver *UpstreamResolver `json:"resolver,omitempty"` |
| 62 | |
| 63 | // Configures TLS to the upstream. Setting this to an empty struct |
| 64 | // is sufficient to enable TLS with reasonable defaults. |
| 65 | TLS *TLSConfig `json:"tls,omitempty"` |
| 66 | |
| 67 | // Configures HTTP Keep-Alive (enabled by default). Should only be |
| 68 | // necessary if rigorous testing has shown that tuning this helps |
| 69 | // improve performance. |
| 70 | KeepAlive *KeepAlive `json:"keep_alive,omitempty"` |
| 71 | |
| 72 | // Whether to enable compression to upstream. Default: true |
| 73 | Compression *bool `json:"compression,omitempty"` |
| 74 | |
| 75 | // Maximum number of connections per host. Default: 0 (no limit) |
| 76 | MaxConnsPerHost int `json:"max_conns_per_host,omitempty"` |
| 77 | |
| 78 | // If non-empty, which PROXY protocol version to send when |
| 79 | // connecting to an upstream. Default: off. |
| 80 | ProxyProtocol string `json:"proxy_protocol,omitempty"` |
| 81 | |
| 82 | // URL to the server that the HTTP transport will use to proxy |
| 83 | // requests to the upstream. See http.Transport.Proxy for |
| 84 | // information regarding supported protocols. This value takes |
| 85 | // precedence over `HTTP_PROXY`, etc. |
| 86 | // |
| 87 | // Providing a value to this parameter results in |
| 88 | // requests flowing through the reverse_proxy in the following |
| 89 | // way: |
| 90 | // |
| 91 | // User Agent -> |
| 92 | // reverse_proxy -> |
| 93 | // forward_proxy_url -> upstream |
| 94 | // |
| 95 | // Default: http.ProxyFromEnvironment |
| 96 | // DEPRECATED: Use NetworkProxyRaw|`network_proxy` instead. Subject to removal. |
| 97 | ForwardProxyURL string `json:"forward_proxy_url,omitempty"` |
| 98 | |
| 99 | // How long to wait before timing out trying to connect to |
| 100 | // an upstream. Default: `3s`. |
| 101 | DialTimeout caddy.Duration `json:"dial_timeout,omitempty"` |
| 102 | |
| 103 | // How long to wait before spawning an RFC 6555 Fast Fallback |
| 104 | // connection. A negative value disables this. Default: `300ms`. |
| 105 | FallbackDelay caddy.Duration `json:"dial_fallback_delay,omitempty"` |
| 106 | |
| 107 | // How long to wait for reading response headers from server. Default: No timeout. |
| 108 | ResponseHeaderTimeout caddy.Duration `json:"response_header_timeout,omitempty"` |
| 109 | |
| 110 | // The length of time to wait for a server's first response |
| 111 | // headers after fully writing the request headers if the |
| 112 | // request has a header "Expect: 100-continue". Default: No timeout. |
nothing calls this directly
no outgoing calls
no test coverage detected