views:

192

answers:

2

For some reason, if I request a file using a url such as this:

http://localhost/proxy.php?url=http%3A//anintranetsite/file.jpg

It works! I can get the file. But if I use,

http://127.0.0.1/proxy.php?url=http%3A//anintranetsite/file.jpg

I cannot get it to work. I am not unnderstanding what is going on... Any thoughts on what could be going wrong?

Thanks

+1  A: 

sounds like a router/firewall problem. localhost is probably aliased to your machine name rather than 127.0.0.1

Ben Rowe
127.0.0.1 should always resolve to your local machine - but if you have namebased servers, you might not get the right document root for the 'website' you're trying to access
HorusKol
Ah... I think I am finally getting somewhere... Do you mind telling me how to modify it so that 127,0.0.1 points to my local machine? Should I be editing the /etc/hosts file or is there any other file? Thanks
Legend
+1  A: 

Sounds like your browser has the proxy configured wrong.

If you're using Firefox make sure that it looks like this. http://i35.tinypic.com/69g8sn.jpg

Aka "No proxy for" should contain localhost AND 127.0.0.1

Gus
Wow! Thanks... That works for the browser... Now is there a global way of setting it so that I can do that even using Java? I mean, I did try the Network Proxy and applying globally in Ubuntu but it doesn't seem to be working...
Legend
I'm not sure, that would be application specific. However Java has some system variables that would do what you want.http://java.sun.com/javase/6/docs/technotes/guides/net/properties.htmlSo for example you'd set http.proxy to your proxy and then add 127.0.0.1 and localhost to nonProxyHosts.This might work as an environment variable like %HTTP_PROXY% but again that's application specific.
Gus
Actually look at this http://www.rgagnon.com/javadetails/java-0085.html near the bottom you can specify those variables through command line so you can do it there. Such as java.exe -Dhttp.nonProxyHosts="*.mycompany.com|*.mycompany.local|localhost"
Gus
I don't know how I solved it... But its working now... I wrote a small relay proxy and requesting the proxy to talk with the intranet server... Thanks for all the help...
Legend