是否有可能(没有请求的应用程序层缓存)在可缓存的情况下防止多次发送对同一资源的 HTTP 请求?如果是,如何?
例如,而不是
at time 0: GET /data (request#1)
at time 1: GET /data (request#2)
at time 2: received response#1 for request#1 // headers indicate that the response can be cached
at time 3: received response#2 for request#2 // headers indicate that the response can be cached
at time 0: GET /data (request#1)
at time 1: GET /data (will wait for the response of request#1)
at time 2: received response#1 for request#1 // headers indicate that the response can be cached
at time 3: returns response#1 for request#2
这将要求它可以在读取响应标头之前向浏览器指示响应将是可缓存的。请问有没有这样的机制。例如,带有某种前面的 OPTIONS 或 HEAD 请求。