I had a problem last week, while developing tweetcetera. I need to use open-uri to open the twitter search url.
BUT, when I develop/test from from my office, I needed to pass through my corporate proxy. Obviously not when I’m at home, and not on my staging/development server.
For the first days I just manage to remove the proxy config variable in my application.rb and that was ok, but it’s certainly not an elegant solution.
First I wanted to create new environments like development_office and test_office, with specific config files … bullshit.
The solution is pretty easy.
open_uri look at environment variables.
Apache use a file call envvars, to setup these environment variables.
So just edit your envvars file (In your Apache folder), and add your env variable like
export http_proxy=http://mycorporate.proxy.com:8080
Restart apache and it’s ok.
Sweet.