Proxy problem (permissions denied)

627 views
Skip to first unread message

Gkpetrak

unread,
Jan 30, 2014, 9:32:32 AM1/30/14
to django...@googlegroups.com
Hello,

I'm trying to develop a GIS app using Django / OpenLayers / GeoServer.
GeoServer is an open source software server that allows users to share and edit geospatial data.

I'm working on development mode, with development server of Django. The base url of my app is: http://127.0.0.1:8000/ and the GeoServer'url is:
http://127.0.0.1:8080/geoserver

I have defined the ProxyHost on the Client Side as follow: OpenLayers.ProxyHost = "http://127.0.0.1:8000/proxy/?url=";

The code of the proxy that I'm using is here:
https://github.com/GeoNode/geonode/blob/master/geonode/proxy/views.py

Whenever the user try to POST something on the app, the terminal display the following error:
[16/Jan/2014 11:43:22] "POST /proxy/?url=http%3A%2F%2F127.0.0.1%3A8080%2Fgeoserver%2Fwps HTTP/1.1" 403 2282
Status 403 means permissions denied.
How can I fix it ?
Is there anything else to do on the Client or Server side with the proxy ?

Thank you in advance
George

Me Sulphur

unread,
Jan 30, 2014, 11:32:28 AM1/30/14
to django...@googlegroups.com
Hopefully you have included the csrfmiddleware token in your POST request payload or data. Overlooking same is usually one of the frequent causes of 403 in development.

BTW, you can also consider using GeoDjango to manipulate and query spatial data from within Django.

Gkpetrak

unread,
Feb 1, 2014, 10:32:27 AM2/1/14
to django...@googlegroups.com
Hi Me Sulphur,

Thank you so much my friend !
A two weeks problem solved !!
The problem was the csrfmiddleware token in my POST request.

Thank you in advance,
George

rmu

unread,
Mar 28, 2014, 2:16:23 AM3/28/14
to django...@googlegroups.com
Hi, I have been stuck in the same proxy thing. While I tried to get wfs point layer from geoserver in openlayers i got error in the chrome console:
  1. OPTIONS http://localhost:8080/geoserver/EMIS/wfs No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. OpenLayers.js:1188
XMLHttpRequest cannot load http://localhost:8080/geoserver/EMIS/wfs. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.
I believe you have solved it using GeoNodes Proxy. I am just starting django and Geodjango. I have few questions:
1. Is the Proxy an app of the GeoNode?
    a. Can I copy the Proxy folder inside by project directory and include it in installed apps of the settings.py file.
2. Would you guide me to use the proxy/view.py. How did you use it?

please help me!!
Sincerely,
Ram Shrestha 

Me Sulphur

unread,
May 26, 2014, 10:57:29 PM5/26/14
to django...@googlegroups.com
Sorry, logging in after a while. Hopefully you have solved the problem by now. Answering just in case some one stumbles upon through Google.

The problem is not the proxy, it is that you are accessing SITE B (localhost:8080) from SITE A (localhost:8000) from within the browser, which is disallowed by default and can be permitted by setting appropriate HTTP Headers. (SO Answer).

Alternatively you can have SITE A "play" reverse proxy for SITE B.


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/u57bbBirVuY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f246303b-4eca-4e59-a9b7-3bcc90f6814f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages