0

My site runs on Apache and I have set expires headers in my .htaccess file like so:

<ifmodule mod_expires.c>
<FilesMatch "\.(ico|jpg|jpeg|png|gif|swf)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
Header append Cache-Control "public"
</FilesMatch>
</ifmodule>

This works great for images that come from my domain. However, 95% of my images are hosted on a cdn called CDN77, which runs on Nginx.

When I run Yslow on my site, it says that all the images being served from CDN77 do not have expires set. I have also confirmed the expires header is not set for those images by viewing the headers in LiveHTTP (Firefox headers viewer plugin).

CDN77 has said they have no way on their end to configure this.

Any thoughts or ideas as to how to set the expires for the images served from the cdn?

4

2 回答 2

0

更改您的 CDN。首先,它们应该允许客户端为标头创建异常,并且 nginx 有一个非常精细的配置集。其次,默认模式应该是从上游服务器(您)复制响应标头,并且仅更改或添加特定于 CDN 的标头,例如主机标头、服务器标头并剥离您可能发送的任何 cookie 标头。

于 2013-06-12T06:50:50.143 回答
0

您无法在 CDN77 上托管的文件上设置过期标头。如果您需要自定义缓存标头,则需要联系他们的支持部门。

到期标头将应用于 CDN 上的所有文件。无法对单个文件或特定文件类型应用不同的到期值。

于 2014-12-19T12:51:22.867 回答