CORS when connecting with Laravel
If you use Apache web server add into .htaccess:
# CORS for PDFs
<Files ~ ".*\.pdf$">
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods "GET"
Header add Access-Control-Allow-Headers: "Range"
Header add Access-Control-Expose-Headers: "Accept-Ranges, Content-Encoding, Content-Length, Content-Range"
I have enabled this through a middleware but still I am getting the same error
I even created a .htaccess file on the root with the code you have provided but still getting the CORS error
This just tells that your webserver does not send allowing headers. Do you administrate your web server by yourself or you have a a hosting provider? If you have, contact them.
The files are placed on the Amazon S3 server.
In this case watch https://m.youtube.com/watch?v=U2nFc4Ksjuo