Documentation
¶
Index ¶
- Variables
- type Mirror
- func (Mirror) CaddyModule() caddy.ModuleInfo
- func (mir *Mirror) Provision(ctx caddy.Context) error
- func (mir *Mirror) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (mir *Mirror) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (mir Mirror) Validate() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotRegular = errors.New("file is not a regular file")
Functions ¶
This section is empty.
Types ¶
type Mirror ¶
type Mirror struct {
// The path to the root of the site. Default is `{http.vars.root}` if set,
// or current working directory otherwise. This should be a trusted value.
//
// Note that a site root is not a sandbox. Although the file server does
// sanitize the request URI to prevent directory traversal, files (including
// links) within the site root may be directly accessed based on the request
// path. Files and folders within the root should be secure and trustworthy.
//
// Responses from upstreams will be written to files within this root directory to be used as a local mirror of static content
Root string `json:"root,omitempty"`
// File name suffix to add to write ETags to.
// If set, file ETags will be written to sidecar files
// with this suffix.
EtagFileSuffix string `json:"etag_file_suffix,omitempty"`
UseXattr bool `json:"xattr,omitempty"`
Sha256Xattr bool `json:"sha256_xattr,omitempty"`
HideTempFiles bool `json:"hide_temp_files,omitempty"`
// contains filtered or unexported fields
}
func (Mirror) CaddyModule ¶
func (Mirror) CaddyModule() caddy.ModuleInfo
func (*Mirror) UnmarshalCaddyfile ¶
UnmarshalCaddyfile parses the mirror directive. It enables the static mirror writer and configures it with this syntax:
mirror [<matcher>] [<root>] {
root <path>
etag_file_suffix <suffix>
xattr [<bool>]
sha256 xattr
}
Click to show internal directories.
Click to hide internal directories.