Exemple #1
0
// sets the configured header for the request
func (f *impl) Request(ctx skipper.FilterContext) {
	req := ctx.Request()
	if f.Key() == "Host" {
		req.Host = f.Value()
	}

	req.Header.Add(f.Key(), f.Value())
}
Exemple #2
0
func (f *typ) Response(c skipper.FilterContext) {
	r := c.Request()
	p := r.URL.Path

	if len(p) < len(f.webRoot) {
		return
	}

	c.MarkServed()
	println("serving static", path.Join(f.root, p[len(f.webRoot):]))
	http.ServeFile(c.ResponseWriter(), c.Request(), path.Join(f.root, p[len(f.webRoot):]))
}
Exemple #3
0
// rewrites the path of the filter
func (f *impl) Request(ctx skipper.FilterContext) {
	req := ctx.Request()
	req.URL.Path = string(f.rx.ReplaceAll([]byte(req.URL.Path), f.replacement))
}
Exemple #4
0
func (f *Filter) Request(ctx skipper.FilterContext) {
	copyHeader(ctx.Request().Header, f.RequestHeaders)
}