“CAUTION: provisional headers are shown” in Chrome debugger

前端 未结 30 3365
滥情空心
滥情空心 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条回答
  •  Happy的楠姐
    2020-11-22 12:32

    My situation is cross-origin related.
    Situation: Browser sends OPTIONS request before sending the real request like GET or POST. Backend developer forgets to deal with the OPTIONS request, letting it go through the service code, making the processing time too long. Longer than the timeout setting I wrote in the axios initialization, which is 5000 milliseconds. Therefore, the real request couldn't be sent, and then I encountered the provisional headers are shown problem.
    Solution: When it comes to OPTIONS request, backend api just return result, it makes the request faster and the real request can be sent before timeout.

提交回复
热议问题