From e2796d7612ddf1617cde698284626df32da00be4 Mon Sep 17 00:00:00 2001 From: Tiago Fernandes Date: Mon, 16 Nov 2020 11:08:43 +0000 Subject: [PATCH] EOEPCA-195 check for Location --- src/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 5a38cf3..57392a6 100644 --- a/src/main.py +++ b/src/main.py @@ -178,8 +178,9 @@ def proxy_request(request, new_header): excluded_headers = ['transfer-encoding'] headers = [(name, value) for (name, value) in res.raw.headers.items() if name.lower() not in excluded_headers] response = Response(res.content, res.status_code, headers) - response.autocorrect_location_header = False - response.headers["Location"] = g_config["proxy_endpoint"] + response.headers["Location"].replace(g_config["resource_server_endpoint"], '') + if "Location" in response.headers: + response.autocorrect_location_header = False + response.headers["Location"] = g_config["proxy_endpoint"] + response.headers["Location"].replace(g_config["resource_server_endpoint"], '') return response except Exception as e: response = Response()