Skip to content

Commit 41347da

Browse files
committed
Summary: Add CORS header when none exist from PASTA #15
Context: Duplicate CORS headers from both PASTA->Gatekeeper and NGINX were causing a browser error Change: Remove NGINX CORS header and replace with only from Gatekeeper where testing for their presence is possible
1 parent e910eef commit 41347da

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

webapp/filter/headers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ async def make_request_headers(pasta_token: PastaToken, edi_token: str, request:
4848

4949

5050
def make_response_headers(pasta_token: PastaToken, edi_token: str, streaming_response: StreamingResponse) -> StreamingResponse:
51+
52+
# Inject CORS header if not present from complex CORS request to PASTA
53+
cors = streaming_response.headers.get("Access-Control-Allow-Origin")
54+
if cors is None:
55+
streaming_response.headers["Access-Control-Allow-Origin"] = "*"
56+
5157
token = Token(edi_token)
5258
auth_token = create_authtoken(Config.PRIVATE_KEY, pasta_token.to_string())
5359
max_age = None

0 commit comments

Comments
 (0)