run: have a fallback when Origin header is missing

This commit is contained in:
Luna Mendes 2018-09-27 23:25:23 -03:00
parent 92f6e3cf75
commit e7d97ecdef
1 changed files with 3 additions and 1 deletions

4
run.py
View File

@ -64,7 +64,9 @@ for bp, suffix in bps.items():
@app.after_request
async def app_after_request(resp):
resp.headers['Access-Control-Allow-Origin'] = request.headers['Origin']
origin = request.headers.get('Origin', '*')
resp.headers['Access-Control-Allow-Origin'] = origin
resp.headers['Access-Control-Allow-Headers'] = ('*, X-Super-Properties, '
'X-Fingerprint, '
'X-Context-Properties, '