proxysetting
Configuring Proxy Settings
In the development world, setting up a proxy is a common task, especially when working behind a corporate firewall or when you want to ensure secure and private browsing. Proxies act as intermediaries between your computer and the internet, helping in filtering requests, improving security, and managing network traffic more efficiently.
NPM
Setting up Proxy in NPM
To configure npm to use a proxy, you can use the
npm config set
command as follows:
1 | npm config set proxy "http://localhost:7890" |
Here, http://localhost:7890
is the address of your proxy
server. Change it according to your proxy server's IP address and port
number.
Removing Proxy Configuration
If you need to remove the proxy configuration, for instance, when
you're not behind a proxy anymore, you can use the
npm config delete
command:
1 | npm config delete proxy |
Linux Shell Proxy Configuration
Setting up Proxy
You can set proxy environment variables in the shell as follows:
1 | export http_proxy="http://localhost:7890" |
Replace localhost:7890
with your proxy server's IP
address and port. Note the difference in the protocol (http
vs. https
) for http_proxy
and
https_proxy
.
Removing Proxy Configuration
To revert the changes or to disable the use of a proxy, you can
unset
these environment variables:
1 | unset http_proxy |
Pip Proxy Configuration
Using Proxy with Pip
1 | pip --proxy http://localhost:7890 install somepackage |
Replace http://localhost:7890
with your proxy's URL.
Append the name of the package you wish to install instead of
somepackage
.
git
1 | git config --global http.proxy http://127.0.0.1:7890 |
1 | git config --global http.https://github.com.proxy http://127.0.0.1:7890 |
1 | git config --global --unset http.proxy |