def fix_location_header(request, response):
 if (('Location' in response) and request.get_host()):
  response['Location'] = request.build_absolute_uri(response['Location'])
 return response

def fix_location_header ( request , response ) : if ( ( 'Location' in response ) and request . get_host ( ) ) : response [ 'Location' ] = request . build_absolute_uri ( response [ 'Location' ] ) return response
ensures that we always use an absolute uri in any location header in the response .