Skip to content

Commit

Permalink
fix: return options response from filter-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
bartjkdp committed Mar 11, 2024
1 parent 83b57ec commit 8a16a02
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/filter-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func main() {

if path.Passthrough {
router.PathPrefix(path.Path).HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodOptions {
w.Header().Add("Methods", "OPTIONS, GET, HEAD")
writeError(w, http.StatusOK, "options response from filter-proxy")
return
}

client := &http.Client{}

//http: Request.RequestURI can't be set in client requests.
Expand Down Expand Up @@ -99,6 +105,12 @@ func main() {
return
}

if r.Method == http.MethodOptions {
w.Header().Add("Methods", "OPTIONS, GET, HEAD")
writeError(w, http.StatusOK, "options response from filter-proxy")
return
}

utils.DelHopHeaders(r.Header)

var bodyFilterParams map[string]interface{}
Expand Down

0 comments on commit 8a16a02

Please sign in to comment.