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

Add CORS Proxy #47

Open
pjdufour opened this issue Sep 1, 2015 · 3 comments
Open

Add CORS Proxy #47

pjdufour opened this issue Sep 1, 2015 · 3 comments
Assignees

Comments

@pjdufour
Copy link
Member

pjdufour commented Sep 1, 2015

Add simple configuration block to the default NGINX server to add additional proxy for /cors to /geoserver that adds

Access-Control-Allow-Origin: *`

but doesn't interfere with direct /geoserver calls. Needed for cross-orgin GeoJSON WFS requests.

For example, from:

http://example.com/geoserver/wfs?srsName=EPSG%3A4326&typename=geonode%3Aexamplelayer&outputFormat=json&version=1.0.0&service=WFS&request=GetFeature

to

http://example.com/cors/geoserver/wfs?srsName=EPSG%3A4326&typename=geonode%3Aexamplelayer&outputFormat=json&version=1.0.0&service=WFS&request=GetFeature

Implementation from http://enable-cors.org/server_nginx.html or something like that. Maybe just HTTP GET.

@pjdufour
Copy link
Member Author

pjdufour commented Sep 2, 2015

Hotfix:

        location /cors/ {
                proxy_pass      http://127.0.0.1:8080/;
                include         /etc/nginx/proxy.conf;
                add_header 'Access-Control-Allow-Origin' '*';
                add_header 'Access-Control-Allow-Credentials' 'false';
                add_header 'Access-Control-Allow-Methods' 'GET';
        }

@pjdufour pjdufour self-assigned this Sep 25, 2015
@diegojpadron
Copy link

Hello,

I need help setting GeoNode / geoserver to accept cross -origin - Access- Control- Allow- Origin : *

Using: Ubuntu 14.04 - Geonode 2.4.1

Any ideas?

Thanks for your attention.

@pjdufour
Copy link
Member Author

I've always inserted header in Apache or NGINX for the specific location/path. Really should be added deeper in stack but it is not right not.

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

2 participants