App Engine, Python: setting Access-Control-Allow-Origin (or other headers) for static file responses
Is there a way to set custom headers of responses to static file 开发者_运维技巧requests?
E.g. I'd want to set Access-Control-Allow-Origin: *
when serving static files.
Yes, you can.
- url: /images
static_dir: static/images
http_headers:
X-Foo-Header: foo
X-Bar-Header: bar value
Here is the documentation
https://developers.google.com/appengine/docs/python/config/appconfig#Static_Directory_Handlers
You can't; the only thing you can do is to stream these static files adding the Access-Control-Allow-Origin
header to the Response.
精彩评论