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
docs: Improve template documentation slightly; use const, not literal
Matthew Holt committed
Apr 24, 2020 at 21:05 UTC
02845bc9fdc3e9189d44f3bd30e8609cd59c97dd
2 files changed
+15
-1
modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
+2
-1
@@ -17,6 +17,7 @@ package fastcgi
17
import (
18
"encoding/json"
19
"net/http"
20
+ "strconv"
21
22
"github.com/caddyserver/caddy/v2"
23
"github.com/caddyserver/caddy/v2/caddyconfig"
@@ -136,7 +137,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error
137
}),
138
}
139
redirHandler := caddyhttp.StaticResponse{
139
- StatusCode: caddyhttp.WeakString("308"),
140
+ StatusCode: caddyhttp.WeakString(strconv.Itoa(http.StatusPermanentRedirect)),
141
Headers: http.Header{"Location": []string{"{http.request.uri.path}/"}},
142
}
143
redirRoute := caddyhttp.Route{
modules/caddyhttp/templates/templates.go
+13
@@ -113,6 +113,19 @@ func init() {
113
// {{.RemoteIP}}
114
// ```
115
//
116
+// ##### `.Req`
117
+//
118
+// Accesses the current HTTP request, which has various fields, including:
119
+//
120
+// - `.Method` - the method
121
+// - `.URL` - the URL, which in turn has component fields (Scheme, Host, Path, etc.)
122
+// - `.Header` - the header fields
123
+// - `.Host` - the Host or :authority header of the request
124
+//
125
+// ```
126
+// {{.Req.Header.Get "User-Agent"}}
127
+// ```
128
+//
129
// ##### `.RespHeader.Add`
130
//
131
// Adds a header field to the HTTP response.