title: “gzip”
sitename: “Caddy中文文档”
http.cors
Caddy默认不支持此功能。如果需要,下载之前需要勾选上http.cors插件。
例子
简单用法
cors
允许所有来源访问所有资源
只允许指定的来源访问域名
cors / http://mytrusteddomain.tld http://myotherdomain.com
只允许来自指定的几个域名的跨域请求。
完整配置
cors / {origin http://allowedSite.comorigin http://anotherSite.org https://anotherSite.orgmethods POST,PUTallow_credentials falsemax_age 3600allowed_headers X-Custom-Header,X-Foobarexposed_headers X-Something-Special,SomethingElse}
这个例子展示了所有可用的选项。
