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

Getting Error file origin does not match viewer's #42

Open
srikanthcx opened this issue Jan 6, 2018 · 10 comments
Open

Getting Error file origin does not match viewer's #42

srikanthcx opened this issue Jan 6, 2018 · 10 comments

Comments

@srikanthcx
Copy link

srikanthcx commented Jan 6, 2018

I am getting error file origin does not match viewer's. so please help me on this. we are using s3 for storage and i have configured CORS with cross origin. But i am getting above error. So please can anbody help me on this.
pdf-error

@gordonbisnor
Copy link

@srikanthcx Wondering if you might need to look into HOSTED_VIEWER_ORIGINS_OPTIONS ?

@siegy22
Copy link
Collaborator

siegy22 commented Jan 9, 2018

Can you open up the dev tools and show the response?

e.g.:
screen shot 2018-01-09 at 15 10 35

@srikanthcx
Copy link
Author

srikanthcx commented Jan 9, 2018

hi siegy22 here the response iam getting

Request URL:https://myhclub.herokuapp.com/pdfjs/full?file=https%3A%2F%2Fhclub-dev.s3.amazonaws.com%2Fuploads%2Fmagazine%2Fmagazine%2F2%2Fmagazine.pdf
Request Method:GET
Status Code:304 Not Modified
Remote Address:54.243.113.132:443
Referrer Policy:no-referrer-when-downgrade

Response Headers

Cache-Control:max-age=0, private, must-revalidate
Connection:keep-alive
Content-Length:0
Date:Tue, 09 Jan 2018 14:39:10 GMT
Etag:W/"bfb7b8a434ba09f199cac6cea21b13f8"
Server:Cowboy
Strict-Transport-Security:max-age=15552000; includeSubDomains
Via:1.1 vegur
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
X-Request-Id:4e9d87ab-81a7-428d-93b3-0c987e7f951e
X-Runtime:0.004548
X-Xss-Protection:1; mode=block

Request Headers

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9
Cache-Control:max-age=0
Connection:keep-alive
Host:myhclub.herokuapp.com
If-None-Match:W/"bfb7b8a434ba09f199cac6cea21b13f8"
Referer:https://myhclub.herokuapp.com/profiles/3
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36
Query String Parameters
view source
view URL encoded
file:https://hclub-dev.s3.amazonaws.com/uploads/magazine/magazine/2/magazine.pdf

@siegy22
Copy link
Collaborator

siegy22 commented Jan 9, 2018

@srikanthcx there you can see that there are no Access-Control-.. headers, they control the CORS things, please make sure to properly set these up.

See: https://github.com/senny/pdfjs_viewer-rails#setting-up-cors

@srikanthcx
Copy link
Author

@siegy22 i have configured it but still iam getting error.

@raykin
Copy link

raykin commented Dec 10, 2018

@gordonbisnor Do you know how to get HOSTED_VIEWER_ORIGINS_OPTIONS from global?

@raykin
Copy link

raykin commented Dec 10, 2018

@srikanthcx I got same problem when I use it in custom angular wrapper(but I don't think the problem is related with this wrapper).
I add custom host into HOSTED_VIEWER_ORIGINS_OPTIONS to fix it
see https://github.com/raykin/pdfjs_viewer-rails
It probably have better solution.

@srikanthreddy919
Copy link

srikanthreddy919 commented Dec 10, 2018

K got it, thanks @raykin

@IanPurdom
Copy link

IanPurdom commented Oct 20, 2019

Hey, same issue here. No other solution than Raykin's ? I've updated HOSTED_VIEWER_ORIGINS_OPTIONS but I still get the error message : "file origin does not match viewer's"

Any help appreciated.

@IanPurdom
Copy link

I commented the code below within viewer.js and now it's working.

if (fileOrigin !== viewerOrigin) {
throw new Error('file origin does not match viewer's');
}

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

6 participants