MCPcopy Create free account
hub / github.com/kataras/iris / NewRedirection

Function NewRedirection

core/host/proxy.go:172–181  ·  view source on GitHub ↗

NewRedirection returns a new host (server supervisor) which redirects all requests to the target. Usage: target, _ := url.Parse("https://mydomain.com") r := NewRedirection(":80", target, 307) r.ListenAndServe() // use of `r.Shutdown` to close this server.

(hostAddr string, target *url.URL, redirectStatus int)

Source from the content-addressed store, hash-verified

170// r := NewRedirection(":80", target, 307)
171// r.ListenAndServe() // use of `r.Shutdown` to close this server.
172func NewRedirection(hostAddr string, target *url.URL, redirectStatus int) *Supervisor {
173 redirectSrv := &http.Server{
174 ReadTimeout: 30 * time.Second,
175 WriteTimeout: 60 * time.Second,
176 Addr: hostAddr,
177 Handler: RedirectHandler(target, redirectStatus),
178 }
179
180 return New(redirectSrv)
181}
182
183// RedirectHandler returns a simple redirect handler.
184// See `NewProxy` or `ProxyHandler` for more features.

Callers

nothing calls this directly

Calls 2

RedirectHandlerFunction · 0.85
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…