Select to view content in your preferred language

NetworkError: 403 Forbidden

3324
5
Jump to solution
12-03-2013 02:26 AM
JonGarrido
Occasional Contributor
Hello,

I'm getting crazzy!!

I have a brief testing application that uses a serviceareas service from arcgis online that uses proxy in php to introduce the requiered token. As well the application makes a rest request to a non esri service. When I use the the web application hosted in my local machine it works fine but when I deploy the application to my remote server it gives an error. My remote server is a linux machine (ubuntu 12.04) with apache2, php, and php-curl extension installed and enabled.

From Firefox browser the bug is:

NetworkError: 403 Forbidden - http://jongarrido.es/santander/proxy.php?

From Chrome browser the bug is:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://jongarrido.es' is therefore not allowed access.


Any idea??


Thanks in advance,

Jon Garrido
0 Kudos
1 Solution

Accepted Solutions
JonGarrido
Occasional Contributor
Finally I founded a solution...

I don't know why but:

from http://www.jongarrido.es/santader the proxy works fine.
and from http://jongarrido.es/santander the proxy doesn't work...

Unbeliveble

Thanks for your attention

View solution in original post

0 Kudos
5 Replies
JeffPace
MVP Alum
this is a known cors issue and can be safely ignored.

however, you application is running on  'http://jongarrido.es' correct (not localhost, etc..)

your proxy and application have to be on the same domain
0 Kudos
JonGarrido
Occasional Contributor
Thank you Jeff for your quick response.

Proxy.php and web app are in the same machine and folder.

The problem is that the resquest doesn't finish succesfully, and I can't get a valid response.


When I do the request directly from browser, typing for example:

http://jongarrido.es/santander/proxy.php?http://www.idealista.com/labs/propertyMap.htm?action=json&o...

in apearence, it generates a valid response.

http://www.idealista.com/labs/propertyMap.htm? is a valid url (configured in proxy.php).


However, making the request by using esri.request, the requestFailed function gives the next error:

RequestError: Unable to load http://www.jongarrido.es/santander/proxy.php?http://www.idealista.com/labs/propertyMap.htm?action=js... status: 403

The amazing thing is that deploying the application in my local machine it works fine....


Please help!!


Thanks in advance
0 Kudos
JonGarrido
Occasional Contributor
I have another clue,

I have taken a look on apache error.log and there is a php notice like this:

[Tue Dec 10 16:01:57 2013] [error] [client 90.165.31.215] PHP Notice:  Undefined index: CONTENT_TYPE in /var/www/santander/proxy.php on line 107
[Tue Dec 10 16:01:57 2013] [error] [client 90.165.31.215] PHP Notice:  Undefined index: HTTP_REFERER in /var/www/santander/proxy.php on line 108

Please, any idea?
0 Kudos
JasonScharf
Deactivated User
Check if the service you are trying to access is whitelisted in your proxy.config file. That's the most common source of 403 errors.

Also, be sure to set the proxy URL, e.g.
esri.config.defaults.io.proxyUrl = "/path/to/proxy.php?";
0 Kudos
JonGarrido
Occasional Contributor
Finally I founded a solution...

I don't know why but:

from http://www.jongarrido.es/santader the proxy works fine.
and from http://jongarrido.es/santander the proxy doesn't work...

Unbeliveble

Thanks for your attention
0 Kudos