CAUTION: provisional header are shown

73,304

Solution 1

This is completely normal in chrome (as of recently). There was a discussion here where they discuss the change, essentially on pending requests it was showing certain headers incorrectly, so now they show a warning that these are provisional headers.

From the discussion:

Network Panel: add caution about provisional request headers. (was: In developer tools, request headers for pending requests are incorrect)

I don't know when the fix actually got released, or if you leave Chrome open all the time and so it didn't update for a while - but almost certainly it is nothing you did - just how Chrome works now.

Solution 2

This problem can also show up if you forget to do CORS headers in a cross domain call.

 header("Access-Control-Allow-Origin: *");
Share:
73,304
CBeTJlu4ok
Author by

CBeTJlu4ok

rapidly growing developer

Updated on July 12, 2022

Comments

  • CBeTJlu4ok
    CBeTJlu4ok almost 2 years

    I cant debug this message which appeared like a week ago.

    I tried restoring to old files but this is odd, nothing solves my problem.

    So: I have two long polling requests. (turning one of them off does not help).

    for example this is one of them:

    public function update_private_messages_ajax_handler(){
        global $wpdb;
        global $bp;
        $chat_table = $wpdb->prefix . 'bp_dollars_chat';
    
        $current_user = $bp->loggedin_user->id;
    
        ob_start();
        header("Content-Type: application/json");
        header("Cache-Control: no-cache, must-revalidate");
        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    
        $startTime = time();
        while((time()-$startTime)<=20) {
            $messages = $wpdb->get_results(
                $wpdb->prepare("(SELECT * 
                    FROM $chat_table 
                    WHERE to_user = %d
                    AND recd = 1
                    AND id > %d
                    ORDER BY id DESC) ORDER BY id ASC
                ", $current_user, $_POST['last_id'])
            );
            if($messages) {
                foreach($messages as $v){
                    //$v->timestring = date_i18n($this->date_format.' - '.$this->time_format, $v->unix_timestamp+$this->gmt_offset);
                    $v->name = get_dollar_name($v->from_user);
                    $v->avatar = get_avatar($v->from_user, 50);
                    //$v->message = convert_smilies( $v->message );
                }
                $response = json_encode(array('no_participation' => $this->no_participation, 'success'=> 1, 'messages'=>$messages));
    
                echo $response;
                ob_flush(); flush();
                exit;
            } else {
                sleep($this->options['timeout_refresh_messages']);
            }
        }
    
        $response = json_encode(array('no_participation' => $this->no_participation, 'success'=> 0));
    
        echo $response;
        ob_flush(); flush();
        exit;
    }
    

    As you can see, I sent cache-control headers, so this should not be problem described here I also dont have any adBlocker installed and this is local installation.

    there is a client-side script

    update_private_messages: function() {
        jQuery.post(quick_chat.ajaxurl, {
                action: 'quick-chat-ajax-update-pmessages',
                last_id: quick_chat.last_private_id
            },
            function(data) {
                console.log(data);
                if(data.success == 1) {
                    var updates = data.messages;
                    var already_notified = 0;
                    var chat_history = jQuery('.popoverx.chat.in .chathistory');
                    for(var i=0;typeof(updates[i])!='undefined';i++){
                        // this in case if window open and new message is for current user
                        if(quick_chat.privateOpen == true && (quick_chat.privateOhter == updates[i].from_user || quick_chat.privateOhter == updates[i].to_user )) {
                            // @TODO do I animate every time?
                            jQuery(chat_history).prepend(quick_chat.single_private_html(updates[i])).animate({scrollTop: 0}, 500);
                        } else if(updates[i].recd == 1 && updates[i].from_user != quick_chat.user_id) {
                            // not yet in unread group
                            if(quick_chat.privateUnread.indexOf(parseInt(updates[i].from_user)) == -1) {
                                quick_chat.privateUnread.push(parseInt(updates[i].from_user));
                            }
                            if(already_notified == 0 && quick_chat.last_private_id != 0 && updates[i].from_user != quick_chat.user_id) {
                                if(quick_chat.play_audio == 1) {
                                    quick_chat.audio_element.play();
                                }
                                already_notified = 1;
                            }
                        }
                    }
                    // update label
                    var unreadIcon = jQuery('#bs-navbar-right > li > a.messages');
                    if(quick_chat.privateUnread.length != 0) {
                        unreadIcon.find('span').remove().end().append('<span class="label label-danger">'+ quick_chat.privateUnread.length +'</span>')
                    } else {
                        unreadIcon.find('span').remove()
                    }
                    quick_chat.last_private_id = updates[updates.length-1].id;
                }
                quick_chat.update_private_messages();
            }, 'json'
        );
    }
    

    Is this normal? I cant be normal message for long polling - since its a pending request. Its just does not seem to be documented anywhere


    Note: also I have many short-polling requests and this could be case where more then 6 requests cancel each other but - I also tried turning all other requests off, except one (long polling) and this is not a case


    Here is a original script working so you can see the message: http://www.techytalk.info/wordpress/quick-chat/


    Just to summirize this question: Is this normal? (I don't see this problem on other sites where comet is used) - and if not - Where should I seek for problem, clientside or server-side? Here they say that in such case request is not sent at all, but thats not true, my scripts are working and I cant chat (this is a chat script)

  • CBeTJlu4ok
    CBeTJlu4ok over 10 years
    Sorry this does not work. But could you explain your answer? I mean is this wrong to include headers after ob_start?
  • That Realty Programmer Guy
    That Realty Programmer Guy about 10 years
    @CBeTJlu4ok putting headers after ob_start (if you use ob_start at all) will help you ensure that nothing was output before the headers. If you echo/print/whatever anything else to the output stream before headers, it will result in an error.
  • Krishna Karki
    Krishna Karki almost 8 years
    i m also using codeigniter framework and having same issue. Can you elaborate your answer please.