Documentation ¶
Index ¶
- func JoinURLPath(req *protocol.Request, target string) (path []byte)
- type ReverseProxy
- func (r *ReverseProxy) ServeHTTP(c context.Context, ctx *app.RequestContext)
- func (r *ReverseProxy) SetClient(client *client.Client)
- func (r *ReverseProxy) SetDirector(director func(req *protocol.Request))
- func (r *ReverseProxy) SetErrorHandler(eh func(c *app.RequestContext, err error))
- func (r *ReverseProxy) SetModifyResponse(mr func(*protocol.Response) error)
- func (r *ReverseProxy) SetTransferTrailer(b bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ReverseProxy ¶
type ReverseProxy struct { // target is set as a reverse proxy address Target string // contains filtered or unexported fields }
func NewSingleHostReverseProxy ¶
func NewSingleHostReverseProxy(target string, options ...config.ClientOption) (*ReverseProxy, error)
NewSingleHostReverseProxy returns a new ReverseProxy that routes URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir. NewSingleHostReverseProxy does not rewrite the Host header. To rewrite Host headers, use ReverseProxy directly with a custom director policy.
Note: if no config.ClientOption is passed it will use the default global client.Client instance. When passing config.ClientOption it will initialize a local client.Client instance. Using ReverseProxy.SetClient if there is need for shared customized client.Client instance.
func (*ReverseProxy) ServeHTTP ¶
func (r *ReverseProxy) ServeHTTP(c context.Context, ctx *app.RequestContext)
func (*ReverseProxy) SetClient ¶
func (r *ReverseProxy) SetClient(client *client.Client)
SetClient use to customize client
func (*ReverseProxy) SetDirector ¶
func (r *ReverseProxy) SetDirector(director func(req *protocol.Request))
SetDirector use to customize protocol.Request
func (*ReverseProxy) SetErrorHandler ¶
func (r *ReverseProxy) SetErrorHandler(eh func(c *app.RequestContext, err error))
SetErrorHandler use to customize error handler
func (*ReverseProxy) SetModifyResponse ¶
func (r *ReverseProxy) SetModifyResponse(mr func(*protocol.Response) error)
SetModifyResponse use to modify response
func (*ReverseProxy) SetTransferTrailer ¶ added in v0.1.4
func (r *ReverseProxy) SetTransferTrailer(b bool)