When should I be responding to HTTP HEAD requests on my website
google-app-engine, http
Solution
Implement you `head` method(s) just like the `get` one(s), just skipping the writing of the body. You should do that for every URL that can be linked to, exactly because a well-behaved checker that's validating the links should use HEAD when it doesn't need the body.
Simplest is often to factor out the `get` functionality to a separate auxiliary method `_foo` that takes a boolean `needbody` argument -- `get` calls `self._foo(True)`, `head` calls `self._foo(False)`. `_foo`, if it sees its `needbody` argument is false, can bail out as soon as it has generated all headers (and must make sure it doesn't generate a body).
Problem
My google app engine website is getting errors on the main url for HEAD requests because I am not accepting them. According to this, the HEAD request is for "testing hypertext links for validity, accessibility, and recent modification" What should be my "normal" response to HEAD requests be? I started accepting HEAD requests, to stop the errors from showing in my logs, but only on the main url. Can someone point me in the right direction?