Tuesday, June 23, 2009

The http_proxy Environment Variable

If you use a proxy server or firewall, you may need to set the http_proxy environment variable in order to access some url from commandline.
Example : Installing ppm for perl or applying rpm in linux ,updating ubuntu

Set the http_proxy variable with the hostname or IP address of the proxy server:
http_proxy=http://proxy.example.org
If the proxy server requires a user name and password, include them in the following form:
http_proxy=http://username:password@proxy.example.org
If the proxy server uses a port other than 80, include the port number:
http_proxy=http://username:password@proxy.example.org:8080

Windows XP
  1. Open the Control Panel and click the System icon.
    The System Properties dialog is displayed.
  2. On the Advanced tab, click on Environment Variables.
    The Environment Variables dialog is displayed.
  3. Click New in the System variables panel.
    The New Sytem Variable dialog is displayed.
  4. Add http_proxy with the appropriate proxy information (see examples above).

Linux, Solaris or HP-UX
Set the http_proxy environment variable using the command specific to your shell (e.g. set or export). To make this change persistent, add the command to the appropriate profile file for the shell. For example, in bash, add a line like the following to your .bash_profile or .bashrc file:
   http_proxy=http://username:password@hostname:port;
   export $http_proxy

8 comments:

  1. export http_proxy=http://username:password@141.0.9.177.ictiict.in:8080

    is this a correct statement??

    ReplyDelete
  2. try http_proxy=http://%username%:%password%@141.0.9.177.ictiict.in:8080

    ReplyDelete
  3. what does one do if the '@' character is in the password, Arrrg

    ReplyDelete
    Replies
    1. substituting %40 for the @ worked for me

      Delete
  4. This is not correct:

    export $http_proxy

    The correct one should be without $ because you want to export the variable no its content.

    export http_proxy

    ReplyDelete
  5. This creates issue when you use utl_http package in oracle db. I'm haven't tested it with username and password set at proxy env variable.
    Just to inform everyone.

    Sundar K

    ReplyDelete
  6. If you wanna access blocked site then check this short method to access without any long methods.
    Mousebreaker UK proxy

    ReplyDelete
  7. Great to know about but I can open in seconds just one click and you can open any blocked site just a click on this.
    Mp3skull UK proxy

    ReplyDelete