3D FlipBook - CORS when connecting with Laravel

Y***r@gmail.com
2020-09-27
2020-09-28

CORS when connecting with Laravel

Replies

a***r@3dflipbook.net
2020-09-28
2020-09-28

If you use Apache web server add into .htaccess:

# CORS for PDFs
<IfModule mod_headers.c>
<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"
</Files>
</IfModule>
Y***r@gmail.com
2020-09-28
2020-09-28

I have enabled this through a middleware but still I am getting the same error

Y***r@gmail.com
2020-09-28
2020-09-28

I even created a .htaccess file on the root with the code you have provided but still getting the CORS error

a***r@3dflipbook.net
2020-09-28
2020-09-28

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.

Y***r@gmail.com
2020-09-28
2020-09-28

I am getting the same error on my local server and on production. In Larave we create CORS middleware and allow from there. I tried that too but none of this works. The call is being made from your javascript code and you guys need to fix it.

a***r@3dflipbook.net
2020-09-29
2020-09-29

It is impossible to fix. Javascript needs permission for ajax from other domain where PDF is placed. The calls go from PDFjs library. Write a link to your page, I will have a look. You need to send these headers from server with PDFs.

Y***r@gmail.com
2020-09-30
2020-09-30

The files are placed on the Amazon S3 server.

a***r@3dflipbook.net
2020-09-30
2020-09-30
Log In to leave a comment