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

PDF preview doesn't work without CORS headers on server #1331

Closed
mbarto opened this issue Dec 7, 2016 · 2 comments
Closed

PDF preview doesn't work without CORS headers on server #1331

mbarto opened this issue Dec 7, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@mbarto
Copy link
Contributor

mbarto commented Dec 7, 2016

It looks like the final pdf file is loaded without a proper proxy, so it doesn't work if CORS headers are not enabled on geoserver.

@mbarto mbarto added the bug label Dec 7, 2016
@mbarto mbarto added this to the R52016 milestone Dec 7, 2016
@saidaipparla
Copy link
Contributor

mozilla/pdf.js#4530 (comment)
as it described here solution for this issue is as follows
For the javascript viewer to display a remotely-hosted pdf document, the following configuration values are necessary:
Access-Control-Allow-Headers "range"
Access-Control-Expose-Headers "content-range, content-length, accept-ranges"

@mbarto
Copy link
Contributor Author

mbarto commented Dec 12, 2016

We cannot assume we have CORS headers enabled (or change them) on a server.

What we can do is use our proxy to access the url (as we do for requests that we run through axios).

Basically, here (https://github.com/geosolutions-it/MapStore2/blob/master/web/client/plugins/print/index.js#L131) we should replace the original url with a url for the proxy. Look here: https://github.com/geosolutions-it/MapStore2/blob/master/web/client/libs/ajax.js#L156

saidaipparla added a commit to saidaipparla/MapStore2 that referenced this issue Dec 12, 2016
@ghost ghost added the pending review label Dec 12, 2016
@mbarto mbarto closed this as completed in 4ae9e34 Dec 13, 2016
@ghost ghost assigned mbarto Dec 13, 2016
@ghost ghost removed the pending review label Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants