We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main import ( "fmt" "github.com/gin-contrib/gzip" "github.com/gin-gonic/gin" "log" "net/http" "time" ) func main() { r := gin.Default() r.Use(func(c *gin.Context) { c.Writer.Header().Add("Vary", "Origin") }, gzip.Gzip(gzip.DefaultCompression)) r.GET("/ping", func(c *gin.Context) { c.String(http.StatusOK, "pong "+fmt.Sprint(time.Now().Unix())) }) // Listen and Server in 0.0.0.0:8080 if err := r.Run(":9000"); err != nil { log.Fatal(err) } }
when running the folowing setup. i expect the Vary headers to contain Accept-Encoding and Origin
Accept-Encoding
Origin
but due to the behavior of the gzip middleware, the Vary header is being overwritten
Vary
shouldnt gzip add the the Accept-Encoding instead over overwriting it ?
The text was updated successfully, but these errors were encountered:
Also, Vary should also include Accept-Encoding when the request did include Accept-Encoding
runephilosof@fedora:~/code/go-test$ curl -i localhost:9000/ping HTTP/1.1 200 OK Content-Type: text/plain; charset=utf-8 Vary: Origin Date: Wed, 20 Sep 2023 12:09:17 GMT Content-Length: 15 pong 1695211757runephilosof@fedora:~/code/go-test$ runephilosof@fedora:~/code/go-test$ curl -i -H 'Accept-Encoding: gzip' localhost:9000/ping HTTP/1.1 200 OK Content-Encoding: gzip Content-Type: text/plain; charset=utf-8 Vary: Accept-Encoding Date: Wed, 20 Sep 2023 12:10:09 GMT Content-Length: 39
Sorry, something went wrong.
No branches or pull requests
when running the folowing setup. i expect the Vary headers to contain
Accept-Encoding
andOrigin
but due to the behavior of the gzip middleware, the
Vary
header is being overwrittenshouldnt gzip add the the
Accept-Encoding
instead over overwriting it ?The text was updated successfully, but these errors were encountered: