Skip to content

Commit 85e714e

Browse files
authored
Merge pull request #43 from delta10/fix/42-options-response-filter-proxy
Return options response from filter-proxy
2 parents 606fe5a + 8a16a02 commit 85e714e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

cmd/filter-proxy/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ func main() {
4545

4646
if path.Passthrough {
4747
router.PathPrefix(path.Path).HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
48+
if r.Method == http.MethodOptions {
49+
w.Header().Add("Methods", "OPTIONS, GET, HEAD")
50+
writeError(w, http.StatusOK, "options response from filter-proxy")
51+
return
52+
}
53+
4854
client := &http.Client{}
4955

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

108+
if r.Method == http.MethodOptions {
109+
w.Header().Add("Methods", "OPTIONS, GET, HEAD")
110+
writeError(w, http.StatusOK, "options response from filter-proxy")
111+
return
112+
}
113+
102114
utils.DelHopHeaders(r.Header)
103115

104116
var bodyFilterParams map[string]interface{}

0 commit comments

Comments
 (0)