Chrome 显示临时标头和挂起请求

lxkprmvk  于 2023-01-28  发布在  Go
关注(0)|答案(1)|浏览(222)

我有一个问题vue-resource导致临时标题显示在Chrome上,使用jQuery另一方面工作没有任何问题

    • 只有Chrome + vue-resource才会出现此问题**

复制链接

浏览器57.0.2987 windows 7
我没有安装adblock或origin,即使在Chrome的访客模式下也会发生这种情况
使用setInterval设置的简单调用

new Vue({

  el: '#main',

  data: {
    summary: null
  },
        methods: {
            updateSummary: function() {
      /*
                $.post( "summary.php", function( data ) {
                    if(typeof response.body.summary != 'undefined'){
                        this.summary = response.body.summary;
                    }
                });
        */
                this.$http.post('summary.php').then(function(response) {
                    if(typeof response.body.summary != 'undefined'){
                        this.summary = response.body.summary;
                    }
                });
            }
      },
        mounted: function () {
            this.updateSummary();

            setInterval(function () {
                this.updateSummary();
            }.bind(this), 2000);
        }
});

https://jsfiddle.net/7vo2s8z3/1/

重现步骤

通常当我让页面打开几个小时时会发生这种情况

预期内容是什么?

200代码响应,提供内容

到底发生了什么?

我收到一个带有这些标头的请求
请求网址:http://127.0.0.1:8080/monitor/summary.php推荐人策略:降级时无推荐人请求标头

    • 显示临时标头**接受:应用程序/json,文本/纯文本,*/*内容类型:应用程序/json;字符集= utf-8来源:http://127.0.0.1:8080参考人:http://127.0.0.1:8080/monitor/用户代理:Mozilla/5.0( windows NT 6.1;WOW64)苹果网络工具包/537.36(KHTML,类似于壁虎)Chrome浏览器/57.0.2987.133 Safari浏览器/537.36 X-请求-使用:XMLHttpRequest

看看chrome://net-internals/# events失败的原因是
85487:URL请求http://127.0.0.1:8080/monitor/summary.php开始时间:2017年4月18日09时38分43.826秒
t = 29028 [st = 0]+请求有效[dt = 24184]--〉优先级="中等"--〉网址="www.example.com" t = 29029 [st = 1]+委托信息[dt = 24183]--〉委托被阻止者="重定向到文件资源处理程序" t = 53211 [st = 24183]已取消--〉网络错误= -2http://127.0.0.1:8080/monitor/summary.php" t=29029 [st= 1] +DELEGATE_INFO [dt=24183] --> delegate_blocked_by = "RedirectToFileResourceHandler" t=53211 [st=24183] CANCELLED --> net_error = -2 (ERR_FAILED) t=53212 [st=24184] -REQUEST_ALIVE

esyap4oy

esyap4oy1#

我相信当实际请求没有被发送时会发生这种情况,通常是在加载缓存资源时。
基本上,您向端口8080发送了一个POST请求,导致出现“注意:显示临时标题”消息,如在检查器中所看到的,然后似乎请求被一起阻止。
基于此,一个可能的解决方案是设置nginx来代理将请求从常用的SSL端口443传递到节点的SSL端口8080(节点必须在更高的端口上,因为它不能在prod中作为root运行)。我猜Chrome不喜欢SSL请求到非常规的SSL端口,尽管我绝对同意他们的错误消息可以更具体。

相关问题