staticfiles

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IndexPages = []string{
	"index.html",
	"index.htm",
	"index.txt",
	"default.html",
	"default.htm",
	"default.txt",
}

IndexPages is a list of pages that may be understood as the "index" files to directories.

Functions

func Redirect added in v0.9.1

func Redirect(w http.ResponseWriter, r *http.Request, newPath string, statusCode int)

Redirect sends an HTTP redirect to the client but will preserve the query string for the new path. Based on http.localRedirect from the Go standard library.

Types

type FileServer

type FileServer struct {
	// Jailed disk access
	Root http.FileSystem

	// List of files to treat as "Not Found"
	Hide []string
}

FileServer implements a production-ready file server and is the 'default' handler for all requests to Caddy. It simply loads and serves the URI requested. FileServer is adapted from the one in net/http by the Go authors. Significant modifications have been made.

Original license:

Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

func (FileServer) ServeHTTP

func (fs FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP serves static files for r according to fs's configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL