This commit is contained in:
Bel LaPointe
2026-09-09 14:44:55 -07:00
parent 052b00caae
commit 74b6bef9df
2 changed files with 23 additions and 1 deletions
+6
View File
@@ -28,6 +28,12 @@ type (
To string To string
Redir bool Redir bool
BasicAuth string `yaml:"basicAuth"` BasicAuth string `yaml:"basicAuth"`
If []IfThen
}
IfThen struct {
Headers map[string]string
Then Endpoint
} }
) )
+17 -1
View File
@@ -160,7 +160,23 @@ func (c *Config) endpoint(r *http.Request) Endpoint {
if !ok { if !ok {
return Endpoint{} return Endpoint{}
} }
return m[key]
endpoint, ok := m[key]
if !ok {
return Endpoint{}
}
for _, iffer := range endpoint.If {
matches := true
for k, v := range iffer.Headers {
matches = matches && r.Header.Get(k) == v
}
if matches {
return iffer.Then
}
}
return endpoint
} }
type redirPurge struct { type redirPurge struct {