Call get_routes_as_head only on HEAD requests.
Merge pull request #15321 from tgxworld/only_find_routes_as_heads_for_head_request

Call get_routes_as_head only on HEAD requests.