Browse Source

Some misc. cleanup

The fastcgi changes came from v1 which don't make sense in v2.

Fix comment about default value in reverse proxy keep alive.
master
Matthew Holt 4 years ago
parent
commit
238914d70b
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 10
      modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
  2. 2
      modules/caddyhttp/reverseproxy/httptransport.go

10
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go

@ -236,13 +236,7 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
// original URI in as the value of REQUEST_URI (the user can overwrite this // original URI in as the value of REQUEST_URI (the user can overwrite this
// if desired). Most PHP apps seem to want the original URI. Besides, this is // if desired). Most PHP apps seem to want the original URI. Besides, this is
// how nginx defaults: http://stackoverflow.com/a/12485156/1048862 // how nginx defaults: http://stackoverflow.com/a/12485156/1048862
origReq, ok := r.Context().Value(caddyhttp.OriginalRequestCtxKey).(http.Request) origReq := r.Context().Value(caddyhttp.OriginalRequestCtxKey).(http.Request)
if !ok {
// some requests, like active health checks, don't add this to
// the request context, so we can just use the current URL
origReq = *r
}
reqURL := origReq.URL
requestScheme := "http" requestScheme := "http"
if r.TLS != nil { if r.TLS != nil {
@ -285,7 +279,7 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
"DOCUMENT_ROOT": root, "DOCUMENT_ROOT": root,
"DOCUMENT_URI": docURI, "DOCUMENT_URI": docURI,
"HTTP_HOST": r.Host, // added here, since not always part of headers "HTTP_HOST": r.Host, // added here, since not always part of headers
"REQUEST_URI": reqURL.RequestURI(), "REQUEST_URI": origReq.URL.RequestURI(),
"SCRIPT_FILENAME": scriptFilename, "SCRIPT_FILENAME": scriptFilename,
"SCRIPT_NAME": scriptName, "SCRIPT_NAME": scriptName,
} }

2
modules/caddyhttp/reverseproxy/httptransport.go

@ -411,7 +411,7 @@ type KeepAlive struct {
// Maximum number of idle connections. Default: 0, which means no limit. // Maximum number of idle connections. Default: 0, which means no limit.
MaxIdleConns int `json:"max_idle_conns,omitempty"` MaxIdleConns int `json:"max_idle_conns,omitempty"`
// Maximum number of idle connections per host. Default: 0, which uses Go's default of 2. // Maximum number of idle connections per host. Default: 32.
MaxIdleConnsPerHost int `json:"max_idle_conns_per_host,omitempty"` MaxIdleConnsPerHost int `json:"max_idle_conns_per_host,omitempty"`
// How long connections should be kept alive when idle. Default: 0, which means no timeout. // How long connections should be kept alive when idle. Default: 0, which means no timeout.

Loading…
Cancel
Save