Documentation
¶
Overview ¶
httpxtra is a wrapper for http.Handler that adds extra features to the server:
- Custom logging
- Support for listening on TCP or UNIX sockets
- Support X-Real-IP and X-Forwarded-For as the remote IP if the server sits behind a proxy or load balancer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApacheCommonLog ¶
ApacheCommonLog returns an Apache Common access log string.
func ListenAndServe ¶
ListenAndServe can listen on both TCP and UNIX sockets.
Types ¶
type Handler ¶
type Handler struct {
Handler http.Handler
Logger LoggerFunc
XHeaders bool
}
Handler is the http.Handler wrapper with extra features.
func (Handler) ServeHTTP ¶
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is a wrapper for the request, which can modify the value of the RemoteAddr and later calls the logger function.
Note that when XHeaders are enabled, the value of RemoteAddr might be a copy of the X-Real-IP or X-Forwarded-For HTTP header, which can be a comma separated list of IPs.
See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers for details.
type LogWriter ¶
type LogWriter struct {
ResponseWriter http.ResponseWriter
Bytes int
Status int
}
func (*LogWriter) CloseNotify ¶
func (*LogWriter) WriteHeader ¶
Click to show internal directories.
Click to hide internal directories.