mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-05 20:32:57 +02:00
add cors_allow_preflight option to route policy
This commit is contained in:
parent
c18f7d89ae
commit
45bb2e0a4d
8 changed files with 146 additions and 58 deletions
|
@ -117,10 +117,10 @@ func ValidateSignature(sharedSecret string) func(next http.Handler) http.Handler
|
|||
}
|
||||
|
||||
// ValidateHost ensures that each request's host is valid
|
||||
func ValidateHost(mux map[string]http.Handler) func(next http.Handler) http.Handler {
|
||||
func ValidateHost(validHost func(host string) bool) func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if _, ok := mux[r.Host]; !ok {
|
||||
if !validHost(r.Host) {
|
||||
httputil.ErrorResponse(w, r, "Unknown route", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue