RuHttpHeadersModule
Contents |
[edit] ngx_http_headers_module
袦芯写褍谢褜 ngx_http_headers_module 锌芯蟹胁芯谢褟械褌 胁褘写邪胁邪褌褜 褋褌褉芯泻懈 "Expires" 懈 "Cache-Control" 懈 写芯斜邪胁谢褟褌褜 锌褉芯懈蟹胁芯谢褜薪褘械 褋褌褉芯泻懈 胁 蟹邪谐芯谢芯胁泻械 芯褌胁械褌邪. 小芯写械褉卸邪薪懈械 袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈
[edit] 袛懈褉械泻褌懈胁褘
- [#add_header add_header]
- [#expires expires]
袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈
: expires 24h; : expires 0; : expires -1; : expires epoch; : add_header Cache-Control private;
[edit] add_header
syntax: add_header 薪邪蟹胁邪薪懈械 蟹薪邪褔械薪懈械
default: 薪械褌
context: http, server, location
袛懈褉械泻褌懈胁邪 写芯斜邪胁谢褟械褌 褋褌褉芯泻褍 胁 蟹邪谐芯谢芯胁泻械 芯褌胁械褌邪 锌褉懈 褍褋谢芯胁懈懈, 褔褌芯 泻芯写 芯褌胁械褌邪 褉邪胁械薪 200, 204, 301, 302 懈谢懈 304. 袙 蟹薪邪褔械薪懈懈 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 锌械褉械屑械薪薪褘械.
[edit] expires
syntax: expires [胁褉械屑褟|epoch|off]
default: expires off
context: http, server, location
袪邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 写芯斜邪胁谢褟褌褜 懈谢懈 屑械薪褟褌褜 褋褌褉芯泻懈 "Expires" 懈 "Cache-Control" 胁 蟹邪谐芯谢芯胁泻械 芯褌胁械褌邪. 袙 泻邪褔械褋褌胁械 锌邪褉邪屑械褌褉邪 屑芯卸薪芯 蟹邪写邪褌褜 锌芯谢芯卸懈褌械谢褜薪芯械 懈谢懈 芯褌褉懈褑邪褌械谢褜薪芯械 胁褉械屑褟. 袙褉械屑褟 胁 褋褌褉芯泻械 "Expires" 锌芯谢褍褔邪械褌褋褟 泻邪泻 褋褍屑屑邪 褌械泻褍褖械谐芯 胁褉械屑械薪懈 懈 胁褉械屑械薪懈, 蟹邪写邪薪薪芯谐芯 胁 写懈褉械泻褌懈胁械. 袩邪褉邪屑械褌褉 "epoch" 芯蟹薪邪褔邪械褌 邪斜褋芯谢褞褌薪芯械 胁褉械屑褟 1 褟薪胁邪褉褟 1970 谐芯写邪 00:00:01 GMT. 小芯写械褉卸懈屑芯械 褋褌褉芯泻懈 "Cache-Control" 蟹邪胁懈褋懈褌 芯褌 蟹薪邪泻邪 蟹邪写邪薪薪芯谐芯 胁褉械屑械薪懈:
- 芯褌褉懈褑邪褌械谢褜薪芯械 胁褉械屑褟 鈥 "Cache-Control: no-cache".
- 锌芯谢芯卸懈褌械谢褜薪芯械 胁褉械屑褟 懈谢懈 褉邪胁薪芯械 薪褍谢褞 鈥 "Cache-Control: max-age=#", 谐写械 "#" - 褝褌芯 胁褉械屑褟 胁 褋械泻褍薪写邪褏, 蟹邪写邪薪薪芯械 胁 写懈褉械泻褌懈胁械.
袩邪褉邪屑械褌褉 "off" 蟹邪锌褉械褖邪械褌 写芯斜邪胁谢褟褌褜 懈谢懈 屑械薪褟褌褜 褋褌褉芯泻懈 "Expires" 懈 "Cache-Control" 胁 蟹邪谐芯谢芯胁泻械 芯褌胁械褌邪.