Sometimes we need to fetch static resources (PDF files, images, videos etc)from a server via a HTTP client in the browser, eg. So we try this in JavaScript: But we see our good old friend CORS error :)
Well it turns out when we request static resources, the web server will serve them directly without passing the HTTP request through Laravel. Since the PHP code in Laravel doesn’t run, the CORS middleware will not run, and therefore the CORS headers are not added to the HTTP response. Before you slam your head against the wall, try to add the following to your server config.