3 ms·
I tried submitting my personal site, https://dmitri.shuralyov.com https://dmitri.shuralyov.com, and got: URL seems to be invalid, please try again! I trie
by shurcooL 10y ago
I tried submitting my personal site, https://dmitri.shuralyov.com https://dmitri.shuralyov.com, and got:
URL seems to be invalid, please try again!
I tried with and without scheme, no luck. Is it a bug? My site redirects from http to https for all queries.
- matthberg 10y agoThey prepopulate a the http, scroll all the way over, it caught me in a similar issue.
- shurcooL 10y agoI tried without "http://" http://" too, it didn't help.
- tyingq 10y agoIt'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.