亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

目錄 搜尋
Guides Access control CORS Authentication Browser detection using the user agent Caching Caching FAQ Compression Conditional requests Connection management in HTTP 1.x Content negotiation Content negotiation: List of default Accept values Cookies CSP Messages Overview Protocol upgrade mechanism Proxy servers and tunneling Proxy servers and tunneling: Proxy Auto-Configuration (PAC) file Public Key Pinning Range requests Redirections Resources and specifications Resources and URIs Response codes Server-Side Access Control Session Guides: Basics Basics of HTTP Choosing between www and non-www URLs Data URIs Evolution of HTTP Identifying resources on the Web MIME Types MIME types: Complete list of MIME types CSP Content-Security-Policy Content-Security-Policy-Report-Only CSP: base-uri CSP: block-all-mixed-content CSP: child-src CSP: connect-src CSP: default-src CSP: font-src CSP: form-action CSP: frame-ancestors CSP: frame-src CSP: img-src CSP: manifest-src CSP: media-src CSP: object-src CSP: plugin-types CSP: referrer CSP: report-uri CSP: require-sri-for CSP: sandbox CSP: script-src CSP: style-src CSP: upgrade-insecure-requests CSP: worker-src Headers Accept Accept-Charset Accept-Encoding Accept-Language Accept-Ranges Access-Control-Allow-Credentials Access-Control-Allow-Headers Access-Control-Allow-Methods Access-Control-Allow-Origin Access-Control-Expose-Headers Access-Control-Max-Age Access-Control-Request-Headers Access-Control-Request-Method Age Allow Authorization Cache-Control Connection Content-Disposition Content-Encoding Content-Language Content-Length Content-Location Content-Range Content-Type Cookie Cookie2 Date DNT ETag Expect Expires Forwarded From Headers Host If-Match If-Modified-Since If-None-Match If-Range If-Unmodified-Since Keep-Alive Large-Allocation Last-Modified Location Origin Pragma Proxy-Authenticate Proxy-Authorization Public-Key-Pins Public-Key-Pins-Report-Only Range Referer Referrer-Policy Retry-After Server Set-Cookie Set-Cookie2 SourceMap Strict-Transport-Security TE Tk Trailer Transfer-Encoding Upgrade-Insecure-Requests User-Agent User-Agent: Firefox Vary Via Warning WWW-Authenticate X-Content-Type-Options X-DNS-Prefetch-Control X-Forwarded-For X-Forwarded-Host X-Forwarded-Proto X-Frame-Options X-XSS-Protection Methods CONNECT DELETE GET HEAD Methods OPTIONS PATCH POST PUT Status 100 Continue 101 Switching Protocols 200 OK 201 Created 202 Accepted 203 Non-Authoritative Information 204 No Content 205 Reset Content 206 Partial Content 300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 304 Not Modified 307 Temporary Redirect 308 Permanent Redirect 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 407 Proxy Authentication Required 408 Request Timeout 409 Conflict 410 Gone 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 URI Too Long 415 Unsupported Media Type 416 Range Not Satisfiable 417 Expectation Failed 426 Upgrade Required 428 Precondition Required 429 Too Many Requests 431 Request Header Fields Too Large 451 Unavailable For Legal Reasons 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported 511 Network Authentication Required Status
文字

Cache-Control通用頭字段用于指定在兩個(gè),請(qǐng)求和響應(yīng)的緩存機(jī)制的指令。緩存指令是單向的,這意味著請(qǐng)求中的給定指令并不意味著將在響應(yīng)中給出相同的指令。

Header type

General header

Forbidden header name

no

CORS-safelisted response-header

yes

語法

這些指令不區(qū)分大小寫,并且有一個(gè)可選參數(shù),可以同時(shí)使用令牌和帶引號(hào)的字符串語法。多個(gè)指令用逗號(hào)分隔。

緩存請(qǐng)求指令

Cache-Control客戶端可以在 HTTP 請(qǐng)求中使用的標(biāo)準(zhǔn)指令。

Cache-Control: max-age=<seconds>Cache-Control: max-stale[=<seconds>]Cache-Control: min-fresh=<seconds>Cache-Control: no-cache 
Cache-Control: no-store
Cache-Control: no-transform
Cache-Control: only-if-cached

緩存響應(yīng)指令

Cache-Control服務(wù)器可以在 HTTP 響應(yīng)中使用的標(biāo)準(zhǔn)指令。

Cache-Control: must-revalidate
Cache-Control: no-cache
Cache-Control: no-store
Cache-Control: no-transform
Cache-Control: publicCache-Control: privateCache-Control: proxy-revalidate
Cache-Control: max-age=<seconds>Cache-Control: s-maxage=<seconds>

擴(kuò)展Cache-Control指令

擴(kuò)展Cache-Control指令不是核心 HTTP 緩存標(biāo)準(zhǔn)文檔的一部分。請(qǐng)務(wù)必檢查兼容性表格以獲取支持。

Cache-Control: immutable 
Cache-Control: stale-while-revalidate=<seconds>Cache-Control: stale-if-error=<seconds>

指令

可緩存

public指示響應(yīng)可能被任何緩存緩存。

private指示該響應(yīng)是針對(duì)單個(gè)用戶的,并且不能由共享緩存存儲(chǔ)。私有緩存可以存儲(chǔ)該響應(yīng)。

no-cache在釋放緩存副本之前,強(qiáng)制高速緩存將請(qǐng)求提交給原始服務(wù)器進(jìn)行驗(yàn)證。

only-if-cached表示不檢索新數(shù)據(jù)??蛻舳酥幌M@得緩存的響應(yīng),并且不應(yīng)該聯(lián)系原始服務(wù)器以查看是否存在新的副本。

Expiration

max-age=<seconds>指定資源被視為新鮮的最長時(shí)間。相反Expires,這個(gè)指令是相對(duì)于請(qǐng)求的時(shí)間而言的。

s-maxage=<seconds>覆蓋max-ageExpires標(biāo)題,但它只適用于共享緩存(例如,代理)并被私有緩存忽略。

max-stale[=<seconds>]表示客戶愿意接受超過其到期時(shí)間的響應(yīng)。或者,您可以以秒為單位指定一個(gè)值,指示響應(yīng)不能過期的時(shí)間。

min-fresh=<seconds>表示客戶想要的響應(yīng)至少在指定的秒數(shù)內(nèi)仍然是新鮮的。

stale-while-revalidate=<seconds>指示客戶端愿意接受陳舊的響應(yīng),同時(shí)在后臺(tái)異步檢查新的響應(yīng)。秒值指示客戶愿意接受陳舊響應(yīng)的時(shí)間。

stale-if-error=<seconds>

重新驗(yàn)證和重新加載

must-revalidate緩存必須在使用前驗(yàn)證陳舊資源的狀態(tài),不應(yīng)使用過期資源。與之proxy-revalidate相同must-revalidate,但它僅適用于共享緩存(例如,代理)并被私有緩存忽略。

immutable表示響應(yīng)主體不會(huì)隨著時(shí)間而改變。資源如果未到期,則在服務(wù)器上保持不變,因此,即使用戶明確刷新頁面,客戶端也不應(yīng)為其發(fā)送條件重新驗(yàn)證(以檢查更新。根據(jù) HTTP 規(guī)范,不知道這個(gè)擴(kuò)展的客戶端必須忽略它們。在 Firefox 中,immutable只有在交易中才有榮譽(yù)。

其他

no-store緩存不應(yīng)該存儲(chǔ)有關(guān)客戶端請(qǐng)求或服務(wù)器響應(yīng)的任何內(nèi)容。

no-transform不應(yīng)該對(duì)資源進(jìn)行轉(zhuǎn)換或轉(zhuǎn)換。Content-Encoding ,Content-Range ,Content-Type 標(biāo)頭不得被代理修改。例如,一個(gè)不透明的代理可能會(huì)在圖像格式之間進(jìn)行轉(zhuǎn)換,以節(jié)省緩存空間或減少慢速鏈接上的流量。該no-transform指令不允許這樣做。

例子

防止緩存

要關(guān)閉緩存,您可以發(fā)送以下響應(yīng)標(biāo)題。另外,請(qǐng)參閱ExpiresPragma標(biāo)題。

Cache-Control: no-cache, no-store, must-revalidate

緩存靜態(tài)資產(chǎn)

對(duì)于應(yīng)用程序中不會(huì)更改的文件,通常可以通過在下面發(fā)送響應(yīng)標(biāo)題來添加主動(dòng)緩存。這包括由應(yīng)用程序提供的靜態(tài)文件,例如圖像,CSS 文件和 JavaScript 文件。另外,請(qǐng)參閱Expires標(biāo)題。

Cache-Control: public, max-age=31536000

規(guī)范

Specification

Title

RFC 7234

Hypertext Transfer Protocol (HTTP/1.1): Caching

RFC 5861

HTTP Cache-Control Extensions for Stale Content

draft-mcmanus-immutable-00

HTTP Immutable Responses

瀏覽器兼容性

Feature

Chrome

Edge

Firefox

Internet Explorer

Opera

Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

immutable

No

15

49.0

No

No

No1

stale-while-revalidate

No2

No

No3

No

No

No

stale-if-error

No2

No

No3

No

No

No

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

immutable

No

No

No

No

No

No

No

stale-while-revalidate

No

No

No

No

No

No

No

stale-if-error

No

No

No

No

No

No

No

上一篇: 下一篇: