开发者

App Engine, Python: setting Access-Control-Allow-Origin (or other headers) for static file responses

开发者 https://www.devze.com 2023-03-28 03:56 出处:网络
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.

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.

0

精彩评论

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