Login Issues using POST (Wireshark)

Hello

I’m having a strange issue and it seems mostly limited to my devel server. On my devel server I’m displaying the profiling summary and application log on each web page.

The issue is that if I’m attempting to use a POST login, the Gii page is a great example, I press submit and end up back on the login page without an error. I started up Wireshark to see what was going on.

Wireshark is showing that GET request is being made before the 302 redirect. The size of the redirect response is 1.4k (All of the profile data, etc).

I am using Chrome and it would seem the problem is that Chrome is making the GET request while the redirect response is still being downloaded.

I can think of a few hacks that would probably fix this, but I’m curious what others have to say about it.

If I disable cProfileLogroute and CWebLogRoute, it works fine.

okay what does your routing scheme look like and authentication filters. I am guessing your action is being protected by auth

I’m using the default routes and since this is Gii I’m using the defaults from the Yii installation, so there should not be any filters, etc that were changed by me.

The solution I went with is I added this code to my base controller:




public function disableWebLog()

    {

        foreach (Yii::app()->log->routes as $route)

        {

            if($route instanceof CWebLogRoute)

            {

                $route->enabled = false; // disable any weblogroutes

            }

        }

    }



(http://stackoverflow.com/questions/2824805/how-to-get-response-as-json-formatapplication-json-in-yii/13031383#13031383)

Next I overrode the redirect method in my base controller:




public function redirect($url,$terminate=true,$statusCode=302)

    {

        $this->disableWebLog();

        parent::redirect($url,$terminate=true,$statusCode=302);

    }



Now every time I use $this->redirect() all web logging is automatically disabled. All of the issues are gone. ( This obviously didn’t fix Gii since it’s not extended from my base controller).