开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜