开发者

GAE(python): set Access-Control-Allow-Origin

开发者 https://www.devze.com 2023-03-14 14:41 出处:网络
I have a static page in google app engine(python), and I want to $.load() the content of this page from another page -> therefore I have a CORS problem. How can I set in GAE to allow all domains to l开

I have a static page in google app engine(python), and I want to $.load() the content of this page from another page -> therefore I have a CORS problem. How can I set in GAE to allow all domains to l开发者_JAVA百科oad the content of the page?(Access-Control-Allow-Origin: *)


In app.yaml

http_headers:
  X-Foo-Header: foo
  X-Bar-Header: bar value

https://developers.google.com/appengine/docs/python/config/appconfig#Static_Directory_Handlers


Assuming you're using webapp (you haven't specified), put this anywhere in your handler:

self.response.headers['Access-Control-Allow-Origin'] = '*'
0

精彩评论

暂无评论...
验证码 换一张
取 消