Documentation
¶
Index ¶
- type Proxy
- func (p *Proxy) Director(req *http.Request)
- func (p *Proxy) ErrorHandler(w http.ResponseWriter, req *http.Request, err error)
- func (p *Proxy) ModifyResponse(r *http.Response) error
- func (p *Proxy) Serve(addr string) humane.Error
- func (p *Proxy) ServeAsync(addr string)
- func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (p *Proxy) Shutdown() humane.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy represents a reverse proxy server with logging, page management, and request handling capabilities.
func NewProxy ¶
func NewProxy(conf config.StaticPagesConfig) *Proxy
NewProxy initializes and returns a new Proxy instance configured with the provided logger and page definitions.
func (*Proxy) Director ¶
Director modifies the incoming HTTP request to route it to the appropriate backend server based on the request host and path.
func (*Proxy) ErrorHandler ¶
ErrorHandler handles errors during request processing by logging the error and responding with the appropriate HTTP status code.
func (*Proxy) ModifyResponse ¶
ModifyResponse inspects and logs HTTP responses with a status code of 300 or higher, returning nil or an error.
func (*Proxy) Serve ¶
Serve starts the reverse proxy server on the specified address and logs its startup state. It returns a humane.Error if the server fails to start.
func (*Proxy) ServeAsync ¶
ServeAsync starts the reverse proxy server on the specified address and logs the startup message. It runs the server in a separate goroutine and handles failure to start by logging a fatal error. It Panics when the Proxy Server could not start