javascriptphpgoogle-chromevue-resource

Provisional headers are shown and pending requests


I have a problem with vue-resource causing a Provisional headers are shown on Chrome, using jQuery on the other hand work without any problem

The problem only happens with Chrome + vue-resource

Error

Reproduction Link

Chrome 57.0.2987 Windows 7

I don't have adblock or origin installed, and it happen even on guest mode on Chrome

A simple call set with 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/

Steps to reproduce

usually it happens when I leave the page open for a few hours

What is Expected?

A 200 code response with content served

What is actually happening?

I get a request with these headers

Request URL:http://127.0.0.1:8080/monitor/summary.php Referrer Policy:no-referrer-when-downgrade Request Headers

Provisional headers are shown Accept:application/json, text/plain, / Content-Type:application/json;charset=utf-8 Origin:http://127.0.0.1:8080 Referer:http://127.0.0.1:8080/monitor/ User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 X-Requested-With:XMLHttpRequest

And looking at chrome://net-internals/#events the cause of failure is

85487: URL_REQUEST http://127.0.0.1:8080/monitor/summary.php Start Time: 2017-04-18 09:38:43.826

t=29028 [st= 0] +REQUEST_ALIVE [dt=24184] --> priority = "MEDIUM" --> url = "http://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


Solution

  • I believe this happens when the actual request is not sent, usually when you are loading a cached resource.

    Basically you sent a POST request to port 8080 which caused the "CAUTION: provisional headers are shown" message as seen in the inspector and then it seems the request was blocked all together.

    Based on that, one possible solution is to setup nginx to proxy pass the request from the usual SSL port of 443 to the node SSL port of 8080 (node has to be on a higher port as it cannot be ran as root in prod). I guess Chrome doesn't like SSL requests to unconventional SSL ports, though I definitely agree their error message could be more specific.