This commit is contained in:
royjhan 2026-04-22 22:23:51 -05:00 committed by GitHub
commit 6918e157ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1624,6 +1624,11 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc {
if addr, err := netip.ParseAddr(host); err == nil {
if addr.IsLoopback() || addr.IsPrivate() || addr.IsUnspecified() || isLocalIP(addr) {
if c.Request.Method == http.MethodOptions {
c.AbortWithStatus(http.StatusNoContent)
return
}
c.Next()
return
}