Nginx add headers PHP FPM returns an error
Nginx's docs say that add_header
Adds the specified field to a response header provided that the response code equals 200, 201, 204, 206, 301, 302, 303, 304, or 307.
As alternative to HttpHeadersMoreModule
you can add headers in Laravel, here is how it can be done: https://stackoverflow.com/a/17550224
Actually, the solution is quite simple. @dened is right but here how to deal with this problem that I steal from here https://coderwall.com/p/wprykg/cors-with-nginx-for-401-404-501-and-any-other-http-status
add_header 'Access-Control-Allow-Origin' * always;
kudos to Javis V. PĂ©rez