我注意到一个奇怪的警告信息,当使用谷歌chrome检查器(F12)查看下载的资源:

注意显示临时标题

我发现一些可能相关的东西,网络面板:添加临时请求头的警告,但我不能完全理解它。相关问题可以发现Chrome块请求以及XMLHttpRequest无法加载。未加载的资源显示警告:显示临时标头。

与第一个问题类似,我的资源被阻塞了,但后来自动加载了相同的资源。不像第二个问题,我不想解决任何问题;我想知道这条信息是什么意思以及我为什么收到它。


当前回答

这是另一个解决方案。

如果您在使用$ajax()调用时遇到此问题,请在您的serverhost解决问题之前添加http://。

var requestURL = "http://" + serverHost;
$.ajax({
    dataType: "json",
    url: requestURL,
    data: data,
    success: success    
});

其他回答

当我发送无效的HTTP授权报头时,发生了这个问题。我忘记用base64编码了。

I've had this come up very recently (today in fact) where I've had an AJAX call go out to the server and Chrome fires off the "Caution: Provisional headers are shown." In the server side PHP scripting, there are MySQL queries that can be pretty much instant or take a few seconds depending on the given scenario. My server response isn't sent back to the browser until the queries are completed. I've found I get this error only when time consuming queries (up to a few seconds total) are being done and prevent the response from being sent back.

我的场景涉及到一个非常罕见的可能性,即必须通过添加/删除数百个天气模型输出列来更改一个表……因此,迭代ALTER TABLE查询循环会导致响应延迟。

这是另一个解决方案。

如果您在使用$ajax()调用时遇到此问题,请在您的serverhost解决问题之前添加http://。

var requestURL = "http://" + serverHost;
$.ajax({
    dataType: "json",
    url: requestURL,
    data: data,
    success: success    
});

当使用HSTS保护网站时,可能会出现此消息。然后,当有人链接到URL的HTTP版本时,浏览器根据HSTS的指示,不会发出HTTP请求,而是在内部安全地重定向到HTTPS资源。这是为了避免sslstrip等HTTPS降级攻击。

尝试用ctrl + shift +F5重新加载页面,然后再次检查请求头

没有显示完整的头文件,因为有可能请求没有发送到服务器,而是直接从浏览器的缓存(例如使用service worker)提供服务