feat(layer,queue): implement matchURLs option
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good

This commit is contained in:
2023-07-05 13:54:01 -06:00
parent 1ffec1f173
commit ce2c19f9b3
5 changed files with 27 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import (
"time"
"forge.cadoles.com/Cadoles/go-proxy"
"forge.cadoles.com/Cadoles/go-proxy/wildcard"
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director"
"forge.cadoles.com/cadoles/bouncer/internal/store"
"github.com/Masterminds/sprig/v3"
@ -57,6 +58,13 @@ func (q *Queue) Middleware(layer *store.Layer) proxy.Middleware {
return
}
matches := wildcard.MatchAny(r.URL.String(), options.MatchURLs...)
if !matches {
h.ServeHTTP(w, r)
return
}
defer q.updateMetrics(ctx, layer.Proxy, layer.Name, options)
cookieName := q.getCookieName(layer.Name)