-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use externally hosted PDFs (Amazon S3, etc) #12
Comments
@andyweiss1982 sure 👍 Edit: Sorry for the long delay. |
I too have a similar issue with S3 hosted pdf's throwing 403 Access denied errors, even after placing my appropriate URL's in the HOSTED_VIEWER_ORIGINS array. My issue however is limited to Microsoft Edge browsers, and only Edge. I cannot replicate the issue in Chrome, Firefox, Safari etc. Has anyone else experienced this? If so, have you a solution? PDF.js v1.4.20 (build: b15f335) My CORS policy is working for S3 hosted assets such as images, across all browsers, including Edge. This issue seems to be limited to PDF's streamed through pdf.js, via MS Edge only. My Response headers on Chrome are as follows (works great): Accept-Ranges:bytes While my Response headers on MS Edge are: Access-Control-Allow-Credentials: true I notice some obvious differences between the two, especially Content-Type (but i suspect it defaults to xml due to 403 restriction). Any advise would be greatly appreciated. Thanks in advance! |
Any news on this? |
Another alternative to solve this is to use 'rack-reverse-proxy' gem. With this gem you can redirect |
'rack-reverse-proxy' gem is a good gem. However, since your file needs to send through your Rack Server, it can take pretty much time to do so. Thus still would be good if we can configure the origin manually. |
Hi @andyweiss1982 any update on this? |
I recently ran into a version of this error (mozilla/pdf.js#7153) when trying to use this gem to display PDFs hosted in an Amazon S3 bucket. Originally thought I had a CORS issue but was able to solve it by overwriting /pdfjs_viewer/viewer.js and inserting my development and production urls into the
HOSTED_VIEWER_ORIGINS
around line 7100.Would you be open to a pull request, either to add some documentation to the README, or to make
HOSTED_VIEWER_ORIGINS
dependent on an ENV variable?The text was updated successfully, but these errors were encountered: