Skip to content

Commit

Permalink
Remove fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abaldeweg authored Oct 17, 2024
1 parent 2f485b3 commit 9af3ba3
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions gateway/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"io"
"net/http"
"strings"
"time"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -62,27 +61,8 @@ func response(req *http.Request, c *gin.Context) error {
return err
}

for key, values := range resp.Header {
// Skip the Vary header if it only contains "Accept"
if key == "Vary" && len(values) == 1 && values[0] == "Accept" {
continue
}

// Remove "Accept" from the Vary header if it exists
if key == "Vary" {
newValues := []string{}
for _, value := range values {
if value != "Accept" {
newValues = append(newValues, value)
}
}
if len(newValues) > 0 {
c.Header(key, strings.Join(newValues, ", "))
}
continue
}

c.Header(key, values[0])
for key, value := range resp.Header {
c.Header(key, value[0])
}

c.Data(resp.StatusCode, resp.Header.Get("Content-Type"), body)
Expand Down

0 comments on commit 9af3ba3

Please sign in to comment.