I'm building a REST API in Laravel and when a new user is created I want to return a 201 status code and a Location header to point to the new resource.
Most of that is being achieved using this code:
$response = Response::make(null, 201)->header('Location', Config::get('app.url') . '/v1/users/' . $user->id);
return $response;
However Laravel seems to be overriding what I set as the status code because I'm setting a Location header, as I'm getting a 302 Moved Temporarily header back.
How can I force a 201 status code even when I'm specifying a Location header?