I need to put a “201 Created” Response code and a Location header for a POST request, but for some reason I am still getting a 302 response.
This is what I have:
header('HTTP/1.1 201'); header("Location: ..."); // The new resource URL header('Content-type: application/json; charset=utf-8'); echo $response; exit;
I have tried removing the content type, the
echo and the
exit without any luck, still getting the 302. I read that I need to specify both headers, but that’s what I am doing and no luck. I also tried with:
header("Location: ...", TRUE, 201);
Nothing, still got 302
Does anybody knows what I am not seeing?