Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flask how to get the HTTP_ORIGIN of a request

Tags:

python

flask

I'd like to make a response with the "Access-Control-Allow-Origin" header been set all by myself, while it's seems messing up to figure out where the "HTTP_ORIGIN" parameter comes with the request is.

like image 891
Lyfing Avatar asked Feb 11 '15 07:02

Lyfing


1 Answers

This will get you the answer

from flask import request
...
print(request.environ.get('HTTP_ORIGIN', 'default value'))
like image 167
Mahfuz Avatar answered Oct 15 '22 16:10

Mahfuz