Question

I'm having a weird issue with an ajax authentication call. I've seen this question occasionally asked in different forms but with no answer that is working for all my symptoms.

I have an ubuntu server 12.04LTS VM instance running in virutal box. the vm is running apache2 and php5. it has occasionally been giving me the following error:

[ 1074.908203] ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1074.909669] ata3.00: failed command: FLUSH CACHE
(blah blah blah...i'm typing this)
[ 1074.909934]          res 40/00:01:00:00:00/00:00:00:00:00/40 Emask 0x4 (timeout)
[ 1074.910844] ata3.00: status: { DRDY }

I feel confident that this is due to the vm .vdi is on my WD Green 2TB and I'm running a few virtual currency daemons that are working on catching up their block chains. i have an ssd to replace that drive for the vm arriving tomorrow so i'm not as worried about nailing down this issue, but i do feel it's likely relevant

in a global js file, i have

$.ajaxSetup({
    dataType: 'json',
    type    : 'POST'
});

in other js file i have a simple

$.ajax({
    url     : '/authenticate/login',
    data    : {
        email   : email,
        password: password
    },
    success : doLoginCallback
});

that happens on click/touchstart (nothing crazy to this point)

in chrome and firefox (down with ie), i can verify that parameters are being passed to the web server in firebug

Parametersapplication/x-www-form-urlencoded
email       user@domain.com
password    password1

Source
email=user%40domain.com&password=password1

my Authenticate->login method:

class Authenticate extends Core
{
...

public function login()
{
    if($this->input->is_ajax_request())
    {
        $email = $this->input->post('email');
        $password = $this->input->post('password');
        $return = array('success' => false);

        if($email && $password)
        {
            ...(it's not getting this far)...
        }
        else
        {
            $return['err_data'] = array(
                'email'     => $email,
                'password'  => $password,
                'post'      => $_POST
            );
        }

        echo json_encode($return);
    }
    else
    {
        header('Location: /');
        exit();
    }
}
...
}

and it is responding in json, but with a 404 status

{"success":false,"err_data":{"email":false,"password":false,"post":[]}}

"NetworkError: 404 Not Found - http://myvm/authenticate/login"

it would seem that the $_POST array is empty...?

i'm thinking this has to be something in my apache2 configuration that i'm missing; this was working until i had to create a new vm instance off this vdi.

TLDR, i know, but thanks for any thoughts/help!

Was it helpful?

Solution

Thanks to finding this answer by @Lekensteyn, i figured out that mod_rewrite wasn't enabled. to enable mod rewrite for apache2 in ubuntu server:

sudo a2enmod rewrite

and restart apache

/etc/init.d/apache2 restart
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top