【发布时间】:2015-03-30 16:36:10
【问题描述】:
一本关于性能的书读到,您应该使用Expires 或Cache-Control: max-age,但不能同时使用。
Expires 在我的 Apache 上很容易配置。
现在我想禁用不需要的Cache-Control: max-age,但我不知道该怎么做。
【问题讨论】:
标签: apache cache-control
一本关于性能的书读到,您应该使用Expires 或Cache-Control: max-age,但不能同时使用。
Expires 在我的 Apache 上很容易配置。
现在我想禁用不需要的Cache-Control: max-age,但我不知道该怎么做。
【问题讨论】:
标签: apache cache-control
您提到这两个标题表明您使用的是mod_expires。
您不能使用mod_expires 只选择一个标题。设置标头in mod_expires.c 的代码无条件地将两个标头设置为等效值:
apr_table_mergen(t, "Cache-Control",
apr_psprintf(r->pool, "max-age=%" APR_TIME_T_FMT,
apr_time_sec(expires - r->request_time)));
timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
apr_rfc822_date(timestr, expires);
apr_table_setn(t, "Expires", timestr);
但是,using mod_header 可能允许您设置您想要的,使用类似的东西:
Header unset Cache-Control
有一种情况可以同时使用:Cache-Control 允许比Expires 更精细的控制,而Expires 可以帮助更老的客户。
【讨论】: