FAQ

Page Discussion Edit History

ChsHttpHeadersModule

Contents

ngx_http_headers_module

鏈ā鏉垮彲浠ヨ缃瓾TTP鎶ユ枃鐨勫ご鏍囥

__绀轰緥__

: expires     24h;
: expires     0;
: expires     -1;
: expires     epoch;
: add_header  Cache-Control  private;

鎸囦护

  • [#add_header add_header]
  • [#expires expires]

Template:Anchor

澧炲姞澶存爣

璇硶锛 add_header name value

榛樿鍊硷細 none

浣滅敤鍩燂細 http, server, location

褰揌TTP搴旂瓟鐘舵佺爜涓 200銆204銆301銆302 鎴 304 鐨勬椂鍊欙紝澧炲姞鎸囧畾鐨凥TTP澶存爣銆

鍏朵腑澶存爣鐨勫煎彲浠ヤ娇鐢ㄥ彉閲忋

Template:Anchor

expires

璇硶锛 expires [time|epoch|max|off]

榛樿鍊硷細 expires off

浣滅敤鍩燂細 http, server, location

浣跨敤鏈寚浠ゅ彲浠ユ帶鍒禜TTP搴旂瓟涓殑鈥淓xpires鈥濆拰鈥淐ache-Control鈥濈殑澶存爣锛岋紙璧峰埌鎺у埗椤甸潰缂撳瓨鐨勪綔鐢級銆

鍙互鍦╰ime鍊间腑浣跨敤姝f暟鎴栬礋鏁般傗淓xpires鈥濆ご鏍囩殑鍊煎皢閫氳繃褰撳墠绯荤粺鏃堕棿鍔犱笂鎮ㄨ瀹氱殑 time 鍊兼潵鑾峰緱銆

epoch 鎸囧畾鈥淓xpires鈥濈殑鍊间负 1 January, 1970, 00:00:01 GMT銆

max 鎸囧畾鈥淓xpires鈥濈殑鍊间负 31 December 2037 23:59:59 GMT锛屸淐ache-Control鈥濈殑鍊间负10骞淬

-1 鎸囧畾鈥淓xpires鈥濈殑鍊间负 鏈嶅姟鍣ㄥ綋鍓嶆椂闂 -1s,鍗虫案杩滆繃鏈

鈥淐ache-Control鈥濆ご鏍囩殑鍊肩敱鎮ㄦ寚瀹氱殑鏃堕棿鏉ュ喅瀹氾細

  • 璐熸暟锛Cache-Control: no-cache
  • 姝f暟鎴栭浂锛Cache-Control: max-age = #, # 涓烘偍鎸囧畾鏃堕棿鐨勭鏁般

"off" 琛ㄧず涓嶄慨鏀光淓xpires鈥濆拰鈥淐ache-Control鈥濈殑鍊

References

鍘熷鏂囨。