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

"Include in Report" functionality is blocked by CORS policy (services.clarity-h2020.eu) #50

Closed
therter opened this issue Sep 24, 2019 · 14 comments
Assignees
Labels
BB: Report Generation Report Generation Building Block enhancement New feature or request SHOWSTOPPER Feature or bug, that, if not addressed, renders the CSIS essentially useless

Comments

@therter
Copy link

therter commented Sep 24, 2019

Please add the Access-Control-Allow-Origin header to the wms (http://services.clarity-h2020.eu:8080/geoserver/clarity/ows?service=WMS&version=1.0.0&request=GetCapabilities), because at the moment we get the following error, when an image of a map with overlay layers from this wms will be created.

No Access-Control-Allow-Origin' header is present on the requested resource

Perhaps, this comment can help you

@p-a-s-c-a-l p-a-s-c-a-l added the enhancement New feature or request label Sep 26, 2019
@p-a-s-c-a-l p-a-s-c-a-l added this to the 1st Data Package milestone Sep 26, 2019
@p-a-s-c-a-l
Copy link
Member

seems to work now?

@negroscuro
Copy link
Contributor

negroscuro commented Sep 27, 2019

Where is the access done from? do you have an URL?

IMHO, when CORS errors happens they are because there is an access to a different server from the one providing the website.
So this usually iis solved by including CORS headers in the website javascript which is trying to access another server (different domain name or even just different port)

Are you using react right?

@negroscuro
Copy link
Contributor

negroscuro commented Sep 27, 2019

Usually this is solved by adding the CORS headers which are:

Access-Control-Allow-Origin: https://www.mydomain.com
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Authorization, Content-Type
Content-Type: application/json

I am not sure how exactly do it but it should be something similar to this:

var allowCrossDomain = function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); // allow requests from any other server
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); // allow these verbs
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Cache-Control");
 
app.use(allowCrossDomain); // plumbing it in as middleware

With the * you are allowing any other server, but you can state specific ones (services.clarity-h2020.eu:8080 in our case)

@negroscuro
Copy link
Contributor

Mmmmh I am checking buy maybe also Geoserver can include CORS policy to allow request from CSIS...

@negroscuro
Copy link
Contributor

I included such CORS policy in our Tomcat configuration, give it a try please and let me know if anything improved.

@therter
Copy link
Author

therter commented Sep 27, 2019

Thank you, now the wms response contains the Access-Control-Allow-Origin header and the "Include in Report" button is working for this wms. So I can close this issue

@DenoBeno
Copy link

DenoBeno commented Oct 2, 2019

I have added a "best practice describing how to do this.

@therter
Copy link
Author

therter commented Mar 30, 2020

The Access-Control-Allow-Origin header is not set again. See also here.

@p-a-s-c-a-l
Copy link
Member

What is the status? This is also related to #66

@negroscuro
Copy link
Contributor

It should be already solved, did you checked?

@therter
Copy link
Author

therter commented May 8, 2020

It should be already solved, did you checked?

No, this is not solved, yet. But perhaps this will be solved, when the new geoserver is used.

@p-a-s-c-a-l
Copy link
Member

But perhaps this will be solved, when the new geoserver is used.

Yes. I assume that all layer will be served from https://geoserver.myclimateservice.eu/
See also #66 (comment)

@p-a-s-c-a-l p-a-s-c-a-l added STALLED Further Action is requested SHOWSTOPPER Feature or bug, that, if not addressed, renders the CSIS essentially useless labels May 13, 2020
@p-a-s-c-a-l
Copy link
Member

@therter did you check the screenshot functionality with the new geo server? Can we close this issue?

@therter
Copy link
Author

therter commented May 27, 2020

@therter did you check the screenshot functionality with the new geo server? Can we close this issue?

Yes, I have checked this and it works

@therter therter closed this as completed May 27, 2020
@p-a-s-c-a-l p-a-s-c-a-l removed the STALLED Further Action is requested label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BB: Report Generation Report Generation Building Block enhancement New feature or request SHOWSTOPPER Feature or bug, that, if not addressed, renders the CSIS essentially useless
Projects
None yet
Development

No branches or pull requests

5 participants