valyala / fasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
MIT License
21.86k stars 1.76k forks source link

fasthttp.Server GetOnly should also support HEAD requests #1455

Closed TheKigen closed 1 year ago

TheKigen commented 1 year ago

Hi,

While GetOnly does suggest only GET requests should be supported I think it'd be way more useful of a setting if HEAD requests were also allowed with GetOnly set. HEAD requests are functionally similar to GET with the exception that the body of the reply is not expected. HEAD requests are useful for monitoring when you just want to see if the HTTP status is 200. And the main purpose I see behind GetOnly is to block DoS via pushing request bodies and random methods that various bots spam HTTP servers with.

TheKigen commented 1 year ago

Closing this due to the PR being merged.