Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Browse ¶
type Browse struct {
TemplateFile string `json:"template_file,omitempty"`
// contains filtered or unexported fields
}
Browse configures directory browsing.
type FileServer ¶
type FileServer struct {
Root string `json:"root,omitempty"` // default is current directory
Hide []string `json:"hide,omitempty"`
IndexNames []string `json:"index_names,omitempty"`
Browse *Browse `json:"browse,omitempty"`
CanonicalURIs *bool `json:"canonical_uris,omitempty"`
}
FileServer implements a static file server responder for Caddy.
func (FileServer) CaddyModule ¶
func (FileServer) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*FileServer) Provision ¶
func (fsrv *FileServer) Provision(ctx caddy.Context) error
Provision sets up the static files responder.
func (*FileServer) ServeHTTP ¶
func (fsrv *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error
type MatchFile ¶
type MatchFile struct {
// The root directory, used for creating absolute
// file paths, and required when working with
// relative paths; if not specified, the current
// directory is assumed. Accepts placeholders.
Root string `json:"root,omitempty"`
// The list of files to try. Each path here is
// considered relatice to Root. If nil, the
// request URL's path will be assumed. Accepts
// placeholders.
TryFiles []string `json:"try_files,omitempty"`
// How to choose a file in TryFiles.
// Default is first_exist.
TryPolicy string `json:"try_policy,omitempty"`
}
MatchFile is an HTTP request matcher that can match requests based upon file existence.
func (MatchFile) CaddyModule ¶
func (MatchFile) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (MatchFile) Match ¶
Match returns true if r matches m. Returns true if a file was matched. If so, two placeholders will be available:
- http.matchers.file.relative
- http.matchers.file.absolute
func (*MatchFile) UnmarshalCaddyfile ¶
UnmarshalCaddyfile sets up the matcher from Caddyfile tokens. Syntax:
file {
root <path>
try_files <files...>
try_policy first_exist|smallest_size|largest_size|most_recent_modified
}
Click to show internal directories.
Click to hide internal directories.