2 ms·
It's because your site responds to HEAD requests with a 405. They are doing a HEAD request to see if the url is valid, and if it returns anything other than 20
by tyingq 10y ago
It's because your site responds to HEAD requests with a 405.
They are doing a HEAD request to see if the url is valid, and if it returns anything other than 200 OK, they reject the url.
$ curl -IX HEAD https://dmitri.shuralyov.com/
HTTP/1.1 405 Method Not Allowed
- shurcooL 10y agoThanks. Do you have a recommendation on how I should handle HEAD requests? Edit: I went with something like this [1] for now. It worked to solve this problem. I can adjust later as needed. [1] https://github.com/shurcooL/home/commit/b4a601ff7a3752feb291535875646c984c3f5634 https://github.com/shurcooL/home/commit/b4a601ff7a3752feb291...
- tyingq 10y agoThe general idea is to return all the same headers as a get, without the body, so that's likely correct. Unless there's code farther down that sends content length, etags, etc. You would want to send those too. Though I don't know that it really matters much.
- shurcooL 10y agoMakes sense, thanks. Good point about Content-Length and ETag headers. So it sounds like one needs to do exactly the same amount of work to respond to a HEAD request as a GET request. Meaning the body still needs to be rendered (to calculate its length and hash). Just not include it in the response.