“CAUTION: provisional headers are shown” in Chrome debugger

前端 未结 30 2948
滥情空心
滥情空心 2020-11-22 11:52

I noticed a strange caution message when looking at downloaded resources using Google chrome inspector (F12):

Caution provisional headers a

相关标签:
30条回答
  • 2020-11-22 12:09

    I saw this occur when the number of connections to my server exceeded Chrome's max-connections-per-server limit of 6.

    0 讨论(0)
  • 2020-11-22 12:12

    Just throwing in my two cents. I'm writing a Web Application using CORS requests and a full RESTful web service. I have found chrome will throw this error when I have an unhanded exception or a PHP Error thrown. Just incase anyone else runs into the problem. I found that when this happens I can fire up the Chrome App "Postman - Rest Client" and run the exact same request but in the Chrome App I'll actually get the PHP Error thats being thrown instead of this non descriptive error.

    0 讨论(0)
  • 2020-11-22 12:14

    This issue will also occur while using some packages like webpack-hot-middleware and open multiple pages at the same time. webpack-hot-middleware will create a connection for each page for listening to the changes of code then to refresh the page. Each browser has a max-connections-per-server limitation which is 6 for Chrome, so if you have already opened more than 6 pages in Chrome, the new request will be hung there until you close some pages.

    0 讨论(0)
  • 2020-11-22 12:16

    HTTP/2 Pushed resources will produce Provisional headers are shown in the inspector for the same theory as @wvega posted in his answer above.

    e.g: Since the server pushed the resource(s) to the client (before the client requested them), the browser has the resources cached and therefore the client never makes/needs a requests; So because...

    ...the real headers are updated when the server responds, but there is no response if the request was blocked.

    0 讨论(0)
  • 2020-11-22 12:17

    I ran into this issue with an AJAX call that would never complete. I followed wvega's advice and tip about debugging with chrome://net-internals to eventually determine another click event handler in the page, listening on a parent node, was causing the browser to navigate to the same URL (so it wasn't easily noticeable).

    The solution was to add event.stopPropagation() in a click handler on the form submit button to keep the click from bubbling up the DOM and canceling the AJAX request in progress (initiated via a submit handler on the form).

    0 讨论(0)
  • 2020-11-22 12:17

    Use this code fist of your code:

    header('Cache-Control: no-cache, no-store, must-revalidate');
    header('Pragma: no-cache');
    header('Expires: 0');
    

    This works for me.

    0 讨论(0)
提交回复
热议问题