Cannot connect to proxy server remotely.

166 views
Skip to first unread message

Denver Ogaro

unread,
Feb 27, 2016, 3:26:46 PM2/27/16
to gce-discussion
I am running a twisted proxy server on a compute engine instance:

from twisted.web import proxy, http
from twisted.internet import reactor
from twisted.python import log
import sys
log
.startLogging(sys.stdout)


class ProxyFactory(http.HTTPFactory):
    protocol
= proxy.Proxy


reactor
.listenTCP(8080, ProxyFactory())
reactor
.run()

I have a firewall rule to allow http connections to port 8080:

allow-proxy 0.0.0.0/0 tcp:8080 Apply to all targets

When I ssh to the VM, set the `http_proxy` environment variable to http://127.0.0.1:8080, and run `wget icanhazip.com`, all works as expected (a file containing the VM's IP address is created in the current directory).

However, when I try to reproduce that remotely (from my laptop, with `http_proxy` set to the VM's static IP address), I am not able to connect (I get a timeout every time).

Anyone know what might be happening here? Same thing happens when I am using squid.


Kamran (Google Cloud Support)

unread,
Feb 27, 2016, 6:39:18 PM2/27/16
to gce-dis...@googlegroups.com

In order to be able to help you with this issue, I'd like to ask a few questions:

- What OS is running on your laptop?

- Are you setting http_proxy variable using the correct port (8080) and VM's IP address?

- Try to telnet to the proxy server and see if you are able to connect to it using this protocol:  telnet <VM's static IP> 8080

- What is the output of wget on debug mode ( wget -d icanhazip.com )

- Make sure that your Internet provider or remote firewall is not blocking outgoing traffic to port 8080. You may configure your proxy on a different port and test this.


Please note that allowing access to your proxy server, which is not protected by password, to all IP addresses (0.0.0.0/0) can let anybody connect to it and use your proxy. This may not only impact the security of your VMs, but also it’ll affect your network traffic billing.


Sincerely,


Denver Ogaro

unread,
Feb 27, 2016, 9:48:16 PM2/27/16
to gce-discussion
Now that you mentioned it, I realize that this has something to do with the fact that I am running Linux within a Virtualbox VM. I was able to connect when outside the VM. Thanks!

On Saturday, February 27, 2016 at 6:39:18 PM UTC-5, Kamran (Google Cloud Support) wrote:


In order to be able to help you, I'd like to ask a few questions:

Reply all
Reply to author
Forward
0 new messages