Support Location header with raw query, backport #268