@@ -2,6 +2,11 @@ package options
3import "time"
3import "time"
6+ // DefaultUpstreamFlushInterval is the default value for the Upstream FlushInterval.
7+ DefaultUpstreamFlushInterval = 1 * time.Second
5// Upstreams is a collection of definitions for upstream servers.
10// Upstreams is a collection of definitions for upstream servers.
6type Upstreams []Upstream
11type Upstreams []Upstream
@@ -10,11 +15,11 @@ type Upstreams []Upstream
10type Upstream struct {
15type Upstream struct {
11 // ID should be a unique identifier for the upstream.
16 // ID should be a unique identifier for the upstream.
12 // This value is required for all upstreams.
17 // This value is required for all upstreams.
13− ID string `json:"id"`
18+ ID string `json:"id,omitempty"`
15 // Path is used to map requests to the upstream server.
20 // Path is used to map requests to the upstream server.
16 // The closest match will take precedence and all Paths must be unique.
21 // The closest match will take precedence and all Paths must be unique.
17− Path string `json:"path"`
22+ Path string `json:"path,omitempty"`
19 // The URI of the upstream server. This may be an HTTP(S) server of a File
24 // The URI of the upstream server. This may be an HTTP(S) server of a File
20 // based URL. It may include a path, in which case all requests will be served
25 // based URL. It may include a path, in which case all requests will be served
@@ -26,19 +31,19 @@ type Upstream struct {
26 // - file://host/path
31 // - file://host/path
27 // If the URI's path is "/base" and the incoming request was for "/dir",
32 // If the URI's path is "/base" and the incoming request was for "/dir",
28 // the upstream request will be for "/base/dir".
33 // the upstream request will be for "/base/dir".
29− URI string `json:"uri"`
34+ URI string `json:"uri,omitempty"`
31 // InsecureSkipTLSVerify will skip TLS verification of upstream HTTPS hosts.
36 // InsecureSkipTLSVerify will skip TLS verification of upstream HTTPS hosts.
32 // This option is insecure and will allow potential Man-In-The-Middle attacks
37 // This option is insecure and will allow potential Man-In-The-Middle attacks
33 // betweem OAuth2 Proxy and the usptream server.
38 // betweem OAuth2 Proxy and the usptream server.
34 // Defaults to false.
39 // Defaults to false.
35− InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify"`
40+ InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify,omitempty"`
37 // Static will make all requests to this upstream have a static response.
42 // Static will make all requests to this upstream have a static response.
38 // The response will have a body of "Authenticated" and a response code
43 // The response will have a body of "Authenticated" and a response code
39 // matching StaticCode.
44 // matching StaticCode.
40 // If StaticCode is not set, the response will return a 200 response.
45 // If StaticCode is not set, the response will return a 200 response.
41− Static bool `json:"static"`
46+ Static bool `json:"static,omitempty"`
43 // StaticCode determines the response code for the Static response.
48 // StaticCode determines the response code for the Static response.
44 // This option can only be used with Static enabled.
49 // This option can only be used with Static enabled.
@@ -47,14 +52,14 @@ type Upstream struct {
47 // FlushInterval is the period between flushing the response buffer when
52 // FlushInterval is the period between flushing the response buffer when
48 // streaming response from the upstream.
53 // streaming response from the upstream.
49 // Defaults to 1 second.
54 // Defaults to 1 second.
50− FlushInterval *time.Duration `json:"flushInterval,omitempty"`
55+ FlushInterval *Duration `json:"flushInterval,omitempty"`
52 // PassHostHeader determines whether the request host header should be proxied
57 // PassHostHeader determines whether the request host header should be proxied
53 // to the upstream server.
58 // to the upstream server.
54 // Defaults to true.
59 // Defaults to true.
55− PassHostHeader *bool `json:"passHostHeader"`
60+ PassHostHeader *bool `json:"passHostHeader,omitempty"`
57 // ProxyWebSockets enables proxying of websockets to upstream servers
62 // ProxyWebSockets enables proxying of websockets to upstream servers
58 // Defaults to true.
63 // Defaults to true.
59− ProxyWebSockets *bool `json:"proxyWebSockets"`
64+ ProxyWebSockets *bool `json:"proxyWebSockets,omitempty"`