Ticker

6/recent/ticker-posts

What is proxy server and how to set proxy on server?



Proxy server is a server configured with proxy software.

Proxy server acts as a mediator OR gateway between client(browser) and internet. You are indirectly giving internet access to your client or end users.

There could be various reason why you want keep proxy server in your place.

  • Firewall
  • Monitoring internet usage i.e better management
  • Hiding the IP address of your client computer i.e encryption & Decryption of IP
  • For security purpose 
  • Caching
  • To implement internet access control



How to set Proxy on your server:

Linux Machine
See the existing proxy on server if there is any:
[satish@host]$ env | grep -i proxy

Now set proxy on server
[satish@host]$ export http_proxy="http://abc-proxy.domain.com:8080/"
[satish@host]$ export https_proxy="http://abc-proxy.domain.com:8080/"
[satish@host]$ export HTTP_PROXY="http://abc-proxy.domain.com:8080/"
[satish@host]$ export HTTPS_PROXY="http://abc-proxy.domain.com:8080/"
Note: 
  • http_proxy will be used by those addresses who use http protocol.
  • And in same way https_proxy will be used by those addresses who use https protocol.
  • sometimes application looks for http_proxy/https_proxy and sometimes HTTPS_PROXY/HTTPS_PROXY since there is no standard define so it's better to check which one works for you.  
To Unset Proxy
[satish@host]$ unset HTTP_PROXY
[satish@host]$ unset HTTPS_PROXY
[satish@host]$ unset http_proxy
[satish@host]$ unset https_proxy

Set yum package manager behind proxy on Linux server:
[satish@host]$ vi /etc/yum.conf
proxy=http://abc-proxy.domain.com:8080/ 
proxy_username=admin 
proxy_password=admin

Set proxy according to Linux shell (bash, sh):
[satish@host]$ echo "export http_proxy=http://abc-proxy.domain.com:8080/" > /etc/profile.d/http_proxy.sh

Set proxy according to Linux shell (csh, tcsh):
[satish@host]$ echo "export http_proxy=http://abc-proxy.domain.com:8080/" > /etc/profile.d/http_proxy.csh

Set proxy permanently in Linux server:
[satish@host]$ echo "export http_proxy=http://abc-proxy.domain.com:8080/" > /etc/environment

Run CURL command with Proxy:
[satish@host]$ curl http://example.domain.com --proxy http://abc-proxy.domain.com:8080/
[satish@host]$ echo "export http_proxy=http://abc-proxy.domain.com:8080/" > ~/.curlrc

Run WGET command with Proxy:
[satish@host]$ echo "export http_proxy=http://abc-proxy.domain.com:8080/" > /etc/wgetrc
[satish@host]$ echo "export http_proxy=http://abc-proxy.domain.com:8080/" > ~/.wgetrc

Run PIP command with Proxy:
[satish@host]$ pip --proxy http_proxy=http://abc-proxy.domain.com:8080/ install package_name


What is noproxy?

noproxy we use when we don't want to send local server traffic to proxy server in this case we use noproxy.
[satish@host]$ export no_proxy="localhost,*.domain.com,127.0.0.1"
[satish@host]$ export NO_PROXY="localhost,*.domain.com,127.0.0.1"



What is reverse-proxy?

As proxy server protect client information getting exposed to outside world, just opposite to it is Reverse Proxy, It protect server instead of client.



Advantages of Using Reverse Proxy:
  • Compression of request
  • Load balancing
  • Protection from DDoS attack(don't reveal server information to the world)
  • It routes traffic to the outside world on behalf of multiple servers.
  • Elasticbeanstalk usage Apache/Nginx as a reverse proxy that processes web traffic in front of your web app(It can be possible that node server might be running on 8080 port), forwards requests to it, serves static assets, and generates access and error logs.(Ref)



Potential addon topics:
  • transparent proxy
  • inline proxy
  • intercepting proxy
  • forced proxy


That's all for this blog!!

Post a Comment

0 Comments