Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How http proxy clients work

Tags:

http

proxy

web

if an HTTP client reaches a website through a proxy (not reverse proxy) server, what are the actual HTTP request and its parameters that are sent from this client host to the internet?

for example: Proxy Server: www.proxy.com:80 Target website: www.website.com:8081

Does the HTTP client send the following Get request?

Get http://www.proxy.com:80 Host: www.proxy.com:80

OR Get http://www.website.com:8081 Host: www.website.com:8081

if the first case is true, How can the proxy know what is the actual destination to forward this request?

otherwise, if the second is true, how can the request actually reach the proxy host machine?

like image 271
Yoaz Menda Avatar asked Aug 31 '25 15:08

Yoaz Menda


2 Answers

When you want to issue a GET request to http://www.example.com:8081/index.html, the browser connects to www.example.com:8081 and sends the following request:

GET /index.html HTTP/1.1
Host: www.example.com:8081

Now when a proxy is configured, say www.proxy.com:80, the browser will connect to www.proxy.com:80 instead, and issue the following request:

GET http://www.example.com:8081/index.html HTTP/1.1
Host: www.example.com:8081

So when a proxy is configured, the HTTP client connects to the proxy instead of to the target server, and sends the request using the absolute URI.

like image 138
CodeCaster Avatar answered Sep 02 '25 06:09

CodeCaster


Http proxy server can read http headers. Whenever we use http proxy the destination address in the tcp packet(originating from client) has destination address of proxy server.. When the proxy server receives the tcp packet it can read the http headers(which is present in tcp packet payload) the http headers contains the actual destination for the packet.. using this information the http proxy server can forward the packet to actual destination.

Source : https://www.ibm.com/support/knowledgecenter/SSBLQQ_9.1.0/com.ibm.rational.ritpp.install.doc/topics/c_ritpp_advanced_proxy.html

like image 39
Prabhat Rai Avatar answered Sep 02 '25 06:09

Prabhat Rai