I've just installed the the Proximo heroku add-on for a python app. I loaded up a shell and kicked the tires, and hitting a HTTP address works, but HTTPS addresses do not. HTTP addresses show up in the Proximo logs, HTTPS addresses timeout leaving nothing in the logs.

I tested using the following code:

import urllib2, urllib
from django.conf import settings

proxy  = urllib2.ProxyHandler(settings.PROXIES_DICT)
auth   = urllib2.HTTPBasicAuthHandler()
opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler)
urllib2.install_opener(opener)

urllib2.urlopen("http://google.com").read()  # works fine
urllib2.urlopen("https://google.com").read() # times out

I should mention the PROXIES_DICT looks like this (passwords replaced):

>>> pprint(settings.PROXIES_DICT)
{'http': 'http://proxy:password@proxy-54-235-72-96.proximo.io',
 'https': 'http://proxy:password@proxy-54-235-72-96.proximo.io'}

I should also mention the time out exception looks like this:

URLError: <urlopen error [Errno 60] Operation timed out>

I'm not sure what I'm doing wrong. Can anyone help?

有帮助吗?

解决方案

This code tries to connect to Proximo proxy using HTTP but on 443 port. Try following settings:

{'http': 'http://proxy:password@proxy-54-235-72-96.proximo.io',
 'https': 'http://proxy:password@proxy-54-235-72-96.proximo.io:80'}

You are aware that Proximo doesn't listen on HTTPS, so connections from your application to the proxy are not going to be encrypted?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top