Tuesday, 2012 November 06
If you ever needed to develop for Heroku from behind a proxy server, you
may have encountered the problem of not being able to log in, even with
export http_proxy statements in your
bash_profile. Part of the
problem is that the Heroku client uses HTTPS to log in remotely.
To work around this, you can use ProxyChains to tunnel HTTPS connections through your restrictive proxy server. Its role is to provide proxy authentication services for software that otherwise cannot work with proxies.
These instructions have only been tested with Mac OS 10.6.8 and ProxyChains 3.1.
Download the source files for
Whenever I work with source files, I always put them in a certain folder to keep things clean. In this case, I saved
Unpack the archive
$ cd ~/dev/proxychains $ tar xvzf proxychains-3.1.tar.gz
If you're on Mac OS X, you'll need to patch the source in order to compile it. Download the patch from chrootlabs.
From the directory above your source tree, patch the source.
$ cd ~/dev/proxychains $ patch -p0 < proxychains-3.1_osx.diff
Configure the source tree. The
prefixoption is where
make installwill copy the built files.
$ cd ~/dev/proxychains/proxychains-3.1 $ ./configure --prefix=/Users/Kit/dev/build/proxychains
Compile and install
$ make $ make install
In order to run
proxychainsfrom anywhere, you'll need to create a symbolic link in
$ cd /usr/local/bin $ ln -s /Users/Kit/dev/build/proxychains/bin/proxychains proxychains
proxychainsscript a little bit.
$ cd ~/dev/build/proxychains/bin $ vim proxychains
Look for the line that says
and change it to
Copy the library file to the correct folder referenced in the previous step.
$ cd ~ $ mkdir .libs $ cd ~/dev/build/proxychains $ cp lib/libproxychains.3.0.0.dylib ~/.libs
Proxy server setup
proxychains.conffile to your home directory.
$ cd ~ $ mkdir .proxychains $ cd ~/dev/build/proxychains $ cp etc/proxychains.conf ~/.proxychains
Configure the proxy server address.
$ cd ~/.proxychains $ vim proxychains.conf
Comment out the following line so that it looks like
Towards the end of the file, below the header
[ProxyList], add your proxy server in the following format
type host port [user pass]
http 18.104.22.168 8080 user_me pa55w0rd
bashrc, delete or comment out any
exportstatements that set the proxy server for the terminal session. For example
Test your setup with Heroku
$ cd $ proxychains heroku login
Other use cases
This blog is set up so that images are served from my Dropbox account. Therefore, during development, I will still need an Internet connection. Before I discovered ProxyChains, my images would not load during development because my code cannot contact Dropbox through the proxy server. This time, I can start up my development server with the following line, and any outgoing connections are taken care of by ProxyChains.
$ proxychains foreman start