MCPcopy
hub / github.com/caddyserver/caddy / Server

Struct Server

modules/caddyhttp/server.go:47–301  ·  view source on GitHub ↗

Server describes an HTTP server.

Source from the content-addressed store, hash-verified

45
46// Server describes an HTTP server.
47type Server struct {
48 // Socket addresses to which to bind listeners. Accepts
49 // [network addresses](/docs/conventions#network-addresses)
50 // that may include port ranges. Listener addresses must
51 // be unique; they cannot be repeated across all defined
52 // servers.
53 Listen []string `json:"listen,omitempty"`
54
55 // A list of listener wrapper modules, which can modify the behavior
56 // of the base listener. They are applied in the given order.
57 ListenerWrappersRaw []json.RawMessage `json:"listener_wrappers,omitempty" caddy:"namespace=caddy.listeners inline_key=wrapper"`
58
59 // A list of packet conn wrapper modules, which can modify the behavior
60 // of the base packet conn. They are applied in the given order.
61 PacketConnWrappersRaw []json.RawMessage `json:"packet_conn_wrappers,omitempty" caddy:"namespace=caddy.packetconns inline_key=wrapper"`
62
63 // How long to allow a read from a client's upload. Setting this
64 // to a short, non-zero value can mitigate slowloris attacks, but
65 // may also affect legitimately slow clients.
66 ReadTimeout caddy.Duration `json:"read_timeout,omitempty"`
67
68 // ReadHeaderTimeout is like ReadTimeout but for request headers.
69 // Default is 1 minute.
70 ReadHeaderTimeout caddy.Duration `json:"read_header_timeout,omitempty"`
71
72 // WriteTimeout is how long to allow a write to a client. Note
73 // that setting this to a small value when serving large files
74 // may negatively affect legitimately slow clients.
75 WriteTimeout caddy.Duration `json:"write_timeout,omitempty"`
76
77 // IdleTimeout is the maximum time to wait for the next request
78 // when keep-alives are enabled. If zero, a default timeout of
79 // 5m is applied to help avoid resource exhaustion.
80 IdleTimeout caddy.Duration `json:"idle_timeout,omitempty"`
81
82 // KeepAliveInterval is the interval at which TCP keepalive packets
83 // are sent to keep the connection alive at the TCP layer when no other
84 // data is being transmitted.
85 // If zero, the default is 15s.
86 // If negative, keepalive packets are not sent and other keepalive parameters
87 // are ignored.
88 KeepAliveInterval caddy.Duration `json:"keepalive_interval,omitempty"`
89
90 // KeepAliveIdle is the time that the connection must be idle before
91 // the first TCP keep-alive probe is sent when no other data is being
92 // transmitted.
93 // If zero, the default is 15s.
94 // If negative, underlying socket value is unchanged.
95 KeepAliveIdle caddy.Duration `json:"keepalive_idle,omitempty"`
96
97 // KeepAliveCount is the maximum number of TCP keep-alive probes that
98 // should be sent before dropping a connection.
99 // If zero, the default is 9.
100 // If negative, underlying socket value is unchanged.
101 KeepAliveCount int `json:"keepalive_count,omitempty"`
102
103 // MaxHeaderBytes is the maximum size to parse from a client's
104 // HTTP request headers.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected