Documentation ¶
Index ¶
- Variables
- func DebugOnHostHandler(normalHandler http.HandlerFunc) http.HandlerFunc
- func ErrorHandler(w http.ResponseWriter, r *http.Request, err error)
- func GetRoutes() []config.Route
- func PrintRoutes()
- func ReverseProxy() *httputil.ReverseProxy
- func Rewrite(pr *httputil.ProxyRequest)
- func SafeDebugHandler(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
var ( HostID = dflag.DynString(flag.CommandLine, "hostid", "", "host id to show in debug-host output") // optional fortio debug virtual host. DebugHost = dflag.DynString(flag.CommandLine, "debug-host", "", "`hostname` to serve echo debug info on if non-empty (ex: debug.fortio.org)") )
var GzipDebugHandler = fhttp.Gzip(http.HandlerFunc(SafeDebugHandler))
GzipDebugHandler is a handler wrapping SafeDebugHandler with optional gzip compression.
Functions ¶
func DebugOnHostHandler ¶ added in v1.8.0
func DebugOnHostHandler(normalHandler http.HandlerFunc) http.HandlerFunc
func ErrorHandler ¶ added in v1.13.0
func ErrorHandler(w http.ResponseWriter, r *http.Request, err error)
ErrorHandler is the error handler for the ReverseProxy. We use a Scheme marker to know that the error is just there was no route and treat that as 404 and everything else remains a 502.
func GetRoutes ¶
GetRoutes gets the current routes from the dynamic flag routes.json as object (deserialized).
func PrintRoutes ¶
func PrintRoutes()
PrintRoutes prints the current value of the routes config (dflag).
func ReverseProxy ¶
func ReverseProxy() *httputil.ReverseProxy
ReverseProxy returns a new reverse proxy which will route based on the config/dflags.
func Rewrite ¶ added in v1.13.0
func Rewrite(pr *httputil.ProxyRequest)
Rewrite is how incoming request are processed for the ReverseProxy to pick the route/destination.
func SafeDebugHandler ¶ added in v1.6.1
func SafeDebugHandler(w http.ResponseWriter, r *http.Request)
DebugHandler is similar to Fortio's DebugHandler, it returns debug/useful info to http client. but doesn't have some of the extra sensitive info like env dump and host name or echo delay or header setting options.
Types ¶
This section is empty.