Skip to content
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

File origin does not match the viewer's #6

Open
JulianElwood opened this issue Aug 4, 2020 · 17 comments
Open

File origin does not match the viewer's #6

JulianElwood opened this issue Aug 4, 2020 · 17 comments

Comments

@JulianElwood
Copy link

I get this error with any pdf I try to display.
I have media settings option to store media by year and date switched on - Is this causing the error with loading the pdf?
Only threads I see on the web seem to imply I either need to:

Set HOSTED_VIEWER_ORIGINS_OPTIONS - I don't know where to set this or what format is needed

Comment out code for this message - I feel this is unsafe and I don't want to change plug in code in any way

Please help resolve this for me

@TwisterMc
Copy link
Owner

Do you have a URL I could look at?

Are you using a VPN? If so, that might be causing the issue.

@JulianElwood
Copy link
Author

JulianElwood commented Aug 4, 2020 via email

@JulianElwood
Copy link
Author

JulianElwood commented Aug 4, 2020 via email

@TwisterMc
Copy link
Owner

Sorry. I didn't mean VPN, I meant CDN. 🤦‍♂️

The PDF has to load from the same URL as the the site is loading from. If the PDF is offloaded to a CDN, then the URLs won't match.

@JulianElwood
Copy link
Author

JulianElwood commented Aug 4, 2020 via email

@TwisterMc
Copy link
Owner

If you add a PDF to a page, and have the 'Fullscreen' link enabled, can you view the post, hit the 'Fullscreen' link and then paste that link here? It doesn't need to be accessible to me, but I want to see what it looks like.

Example:
https://olaf.local/wp-content/plugins/pdfjs-viewer-shortcode/pdfjs/web/viewer.php?file=https%3A%2F%2Folaf.local%2Fwp-content%2Fuploads%2F2020%2F03%2F7700.pdf&dButton=true&pButton=true&oButton=false&v=1.5.1#zoom=auto

@JulianElwood
Copy link
Author

JulianElwood commented Aug 8, 2020 via email

@JulianElwood
Copy link
Author

JulianElwood commented Aug 12, 2020 via email

@TwisterMc
Copy link
Owner

Can either of you provide me the link the Fullscreen link is going to?

@JulianElwood
Copy link
Author

JulianElwood commented Aug 14, 2020 via email

@TwisterMc
Copy link
Owner

The issue is you can't have two different domains. You can only load PDFs from the same domain that the plugin is running on.

domain-issue

@JulianElwood
Copy link
Author

JulianElwood commented Aug 17, 2020 via email

@TwisterMc
Copy link
Owner

As pointed out in the screenshot, it's reporting to different domains. It could be because it's on a staging site and the uploads are still pointing to production, or it could be that something is configured differently, but the plugin and media domain is different. They may technically be the same domain, but they have different addresses.

@TwisterMc
Copy link
Owner

Try the latest version and see if that helps any.

@Catra-chordeon
Copy link

Using Version: 1.5.7 (as in PlugIn library)/v2.3.200 on WordPress version 5.6 and having the same problem.
Black/blank pdf viewwer shows following error message: PDF.js v2.3.200 (build: 4ae3f9fc)
Message: file origin does not match viewer's

the two pdf files I am trying to display or download are IN my media library, not linked to it. I'm using a more current version than JulianE above. BUT, i AM on a staging site. Thing is, the urls of the media library items have the staging site location incorporated into them. What do i do?

@TwisterMc
Copy link
Owner

Do you have a URL? This issue happens when the PDF is coming from a URL that is not the same as the URL that is showing the PDF.

@rmykolas
Copy link

rmykolas commented Feb 3, 2021

Hi there @TwisterMc, I had the same issue, but I fixed it by adding a list of CDN links to var HOSTED_VIEWER_ORIGINS within the viewer.js file.

But for some reason, this hack does not work with the 1.5.9 version of the plugin. Would you mind updating the repo to see what's changed in the plugin and could be causing this?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants