MCPcopy
hub / github.com/gofiber/fiber / DomainForward

Function DomainForward

middleware/proxy/proxy.go:242–251  ·  view source on GitHub ↗

DomainForward performs an http request based on the given domain and populates the given http response. This method will return a fiber.Handler

(hostname, addr string, clients ...*fasthttp.Client)

Source from the content-addressed store, hash-verified

240// DomainForward performs an http request based on the given domain and populates the given http response.
241// This method will return a fiber.Handler
242func DomainForward(hostname, addr string, clients ...*fasthttp.Client) fiber.Handler {
243 return func(c fiber.Ctx) error {
244 host := utils.UnsafeString(c.Request().Host())
245 if host == hostname {
246 c.Request().Header.Set("X-Real-IP", c.IP())
247 return Do(c, addr+c.OriginalURL(), clients...)
248 }
249 return nil
250 }
251}
252
253type roundrobin struct {
254 pool []string

Calls 6

DoFunction · 0.85
HostMethod · 0.65
RequestMethod · 0.65
SetMethod · 0.65
IPMethod · 0.65
OriginalURLMethod · 0.65