Skip to content

Commit

Permalink
cors always
Browse files Browse the repository at this point in the history
  • Loading branch information
lalexgap committed Nov 14, 2023
1 parent be7c73a commit 681d72c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion paymentproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func NewPaymentProxy(proxyAddress string, nitroEndpoint string, destinationURL s
// It is responsible for parsing the voucher from the query params and moving it to the request header
// It then delegates to the reverse proxy to handle rewriting the request and sending it to the destination
func (p *PaymentProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
enableCors(w.Header())
// If the request is a health check, return a 200 OK
if r.URL.Path == "/health" {
w.WriteHeader(http.StatusOK)
Expand All @@ -96,7 +97,7 @@ func (p *PaymentProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {

if r.Method == "OPTIONS" {
slog.Info("Handling preflight request")
enableCors(w.Header())

w.WriteHeader(http.StatusOK)
return

Expand Down

0 comments on commit 681d72c

Please sign in to comment.