I'm running a local VM for development. It's using php 5.4 with nginx. I've configured nginx to allow for cross origin requests as i'm developing the laravel backend api at **backend.dev** and the frontend ember app at **frontend.dev**. 

The problem i'm running into is when the 400 status code is returned from my backend. Other status codes work just fine: 201, 404, 304. For some reason jQuery just cancels when i return a 400. The chrome debugger just says "canceled", with nothing for a response. 

![enter image description here](https://i.stack.imgur.com/NQ7zm.png)

I hard coded my laravel backend to return a 400 with those two red POSTs. The exact same json body was posted for all requests to the exact same endpoint.

```
class CompanyController extends \BaseController
{
    public function store()
    {
        $json = new stdClass;
        $json->code = 400;
        $json->message = 'Invalid data';

        return Response::json($json, $json->code);
    }
}

```

Here's my nginx conf file for the vhost

```
server {
  listen                *:80 ;

  server_name           backend.dev;
  access_log            /var/log/nginx/backend.dev.com.access.log;

  location / { 

    root  /var/www/backend/public;
    try_files  $uri  $uri/  /index.php?$args ;
    index  index.html index.htm index.php;

  }

  location ~ \.php$ {

        if ($request_method = 'OPTIONS') {

        add_header 'Access-Control-Allow-Origin' '*';

        #
        # Om nom nom cookies
        #

        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';

        #
        # Custom headers and headers various browsers *should* be OK with but aren't
        #

        add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

        #
        # Tell client that this pre-flight info is valid for 20 days
        #

        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain charset=UTF-8';
        add_header 'Content-Length' 0;

        return 204;
     }

     if ($request_method = 'POST') {

        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

     }

     if ($request_method = 'GET') {

        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

     }

    root  /var/www/backend/public;
    try_files  $uri  $uri/  /index.php?$args ;
    index  index.html index.htm index.php;
    fastcgi_index index.php;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param    APP_ENV dev;
    fastcgi_param     APP_DBG true;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
  }
}

```

here is my ember controller

```
App.PeopleNewController = Ember.ObjectController.extend({

    content: Ember.Object.create(),
    firstName: '',
    lastName: '',
    city: '',
    state: '',
    companyName: '',
    email: '',

    actions: {
        doneEditing: function () {

            var firstName = this.get('firstName');
            if (!firstName.trim()) {
                return;
            }

            var lastName = this.get('lastName');
            if (!lastName.trim()) {
                return;
            }

            var city = this.get('city');
            if (!city.trim()) {
                return;
            }

            var state = this.get('state');
            if (!state.trim()) {
                return;
            }

            var email = this.get('email');
            if (!email.trim()) {
                return;
            }

            // Create the new person model
            var person = this.store.createRecord('person', {
                firstName: firstName,
                lastName: lastName,
                city: city,
                state: state,
                email: email
            });

            // Clear the fields
            this.set('firstName', '');
            this.set('lastName', '');
            this.set('city', '');
            this.set('state', '');
            this.set('email', '');
            //this.set('companyName', '');

            // Save the new model
            person.save();
        }
    }
});

```

I get the response just fine in a rest client

![enter image description here](https://i.stack.imgur.com/RpM2B.png)

I have no idea what's causing this. I'd like to get the json response with the 400 status code.