Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NoCacheHeadersMiddleware ¶
type NoCacheHeadersMiddleware struct{}
func NewNoCacheHeadersMiddleware ¶
func NewNoCacheHeadersMiddleware() *NoCacheHeadersMiddleware
func (*NoCacheHeadersMiddleware) ServeHTTP ¶
func (m *NoCacheHeadersMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
NoCache is a simple piece of middleware that sets a number of HTTP headers to prevent a router (or subrouter) from being cached by an upstream proxy and/or client.
As per http://wiki.nginx.org/HttpProxyModule - NoCache sets:
Expires: Thu, 01 Jan 1970 00:00:00 UTC Cache-Control: no-cache, private, max-age=0 X-Accel-Expires: 0 Pragma: no-cache (for HTTP/1.0 proxies/clients)
type RequireContentLengthOrTransferEncodingMiddleware ¶ added in v1.5.0
type RequireContentLengthOrTransferEncodingMiddleware struct{}
RequireContentLengthOrTransferEncodingMiddleware blocks HTTP/1.1 POST requests that lack both Content-Length and Transfer-Encoding headers.
func NewRequireContentLengthOrTransferEncodingMiddleware ¶ added in v1.5.0
func NewRequireContentLengthOrTransferEncodingMiddleware() *RequireContentLengthOrTransferEncodingMiddleware
func (*RequireContentLengthOrTransferEncodingMiddleware) ServeHTTP ¶ added in v1.5.0
func (m *RequireContentLengthOrTransferEncodingMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type RequireContentTypeMiddleware ¶
type RequireContentTypeMiddleware struct {
AllowedContentType string
}
func NewRequireContentTypeMiddleware ¶
func NewRequireContentTypeMiddleware(allowedContentType string) *RequireContentTypeMiddleware
func (*RequireContentTypeMiddleware) ServeHTTP ¶
func (m *RequireContentTypeMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
AllowContentType enforces a whitelist of request Content-Types otherwise responds with a 415 Unsupported Media Type status.
type RequireHTTP11Middleware ¶ added in v1.5.0
type RequireHTTP11Middleware struct{}
RequireHTTP11Middleware blocks requests that are not using HTTP/1.1.
func NewRequireHTTP11Middleware ¶ added in v1.5.0
func NewRequireHTTP11Middleware() *RequireHTTP11Middleware
func (*RequireHTTP11Middleware) ServeHTTP ¶ added in v1.5.0
func (m *RequireHTTP11Middleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type RequireMaxBodyLengthMiddleware ¶ added in v1.1.0
type RequireMaxBodyLengthMiddleware struct {
// contains filtered or unexported fields
}
func NewRequireMaxBodyLengthMiddleware ¶ added in v1.1.0
func NewRequireMaxBodyLengthMiddleware() *RequireMaxBodyLengthMiddleware
func (*RequireMaxBodyLengthMiddleware) ServeHTTP ¶ added in v1.1.0
func (m *RequireMaxBodyLengthMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
AllowContentType enforces a whitelist of request Content-Types otherwise responds with a 415 Unsupported Media Type status.
type SecurityHeadersMiddleware ¶
type SecurityHeadersMiddleware struct{}
func NewRespondWithSecurityHeadersMiddleware ¶
func NewRespondWithSecurityHeadersMiddleware() *SecurityHeadersMiddleware
func (*SecurityHeadersMiddleware) ServeHTTP ¶
func (m *SecurityHeadersMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)