blob: 5d030a62277c159c37a296f4b1bdcfd40b428be4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
def main(request, response):
location = request.GET.first(b"location")
if request.method == u"OPTIONS":
if b"redirect_preflight" in request.GET:
response.status = 302
response.headers.set(b"Location", location)
else:
response.status = 200
response.headers.set(b"Access-Control-Allow-Methods", b"GET")
response.headers.set(b"Access-Control-Max-Age", 1)
elif request.method == u"GET":
response.status = 302
response.headers.set(b"Location", location)
if b"allow_origin" in request.GET:
response.headers.set(b"Access-Control-Allow-Origin", request.headers.get(b"origin"))
if b"allow_header" in request.GET:
response.headers.set(b"Access-Control-Allow-Headers", request.GET.first(b"allow_header"))
|