You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
mstmdev
changed the title
If enable the gzip middleware, the gin server response incorrect for 404 not found by default
If enable the gzip middleware, the gin server returns an incorrect response for 404 status by default
Dec 29, 2021
Enable the gzip middleware, that 404 response like this:
Disable the gzip middleware, that 404 response like this:
Because of the
gz.Close()
will writing the GZIP footer toc.Writer
.gzip/handler.go
Lines 55 to 60 in c784c8e
So gin will not write
default404Body
inserveError
func.We need to customize the
gin.Engine.NoRoute
that responds to the correct 404 content now.https://github.com/gin-gonic/gin/blob/d062a6a6155236883f4c3292379ab94b1eac8b05/gin.go#L632-L637
The text was updated successfully, but these errors were encountered: