mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
docs: Improve template documentation slightly; use const, not literal
This commit is contained in:
parent
97ed9e111d
commit
02845bc9fd
2 changed files with 15 additions and 1 deletions
|
@ -17,6 +17,7 @@ package fastcgi
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/caddyserver/caddy/v2"
|
"github.com/caddyserver/caddy/v2"
|
||||||
"github.com/caddyserver/caddy/v2/caddyconfig"
|
"github.com/caddyserver/caddy/v2/caddyconfig"
|
||||||
|
@ -136,7 +137,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
redirHandler := caddyhttp.StaticResponse{
|
redirHandler := caddyhttp.StaticResponse{
|
||||||
StatusCode: caddyhttp.WeakString("308"),
|
StatusCode: caddyhttp.WeakString(strconv.Itoa(http.StatusPermanentRedirect)),
|
||||||
Headers: http.Header{"Location": []string{"{http.request.uri.path}/"}},
|
Headers: http.Header{"Location": []string{"{http.request.uri.path}/"}},
|
||||||
}
|
}
|
||||||
redirRoute := caddyhttp.Route{
|
redirRoute := caddyhttp.Route{
|
||||||
|
|
|
@ -113,6 +113,19 @@ func init() {
|
||||||
// {{.RemoteIP}}
|
// {{.RemoteIP}}
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
|
// ##### `.Req`
|
||||||
|
//
|
||||||
|
// Accesses the current HTTP request, which has various fields, including:
|
||||||
|
//
|
||||||
|
// - `.Method` - the method
|
||||||
|
// - `.URL` - the URL, which in turn has component fields (Scheme, Host, Path, etc.)
|
||||||
|
// - `.Header` - the header fields
|
||||||
|
// - `.Host` - the Host or :authority header of the request
|
||||||
|
//
|
||||||
|
// ```
|
||||||
|
// {{.Req.Header.Get "User-Agent"}}
|
||||||
|
// ```
|
||||||
|
//
|
||||||
// ##### `.RespHeader.Add`
|
// ##### `.RespHeader.Add`
|
||||||
//
|
//
|
||||||
// Adds a header field to the HTTP response.
|
// Adds a header field to the HTTP response.
|
||||||
|
|
Loading…
Reference in a new issue