Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I want to connect to say, IP 100.100.100.100, Port 80, my computer will send a tcp packet with this adress into the wire.

Now If I use a proxy server say, 200.200.200.200 Port 8080 (such kind of proxy that you can set up in internet explorer) how is this process changed?

When I still want to connect to the same IP, will the IP header will include the destination IP or the proxy IP or both?

I already googled, there are hundreds of pages that tell you how to set up a proxy but none explains how it works under the hood.

share|improve this question

3 Answers 3

up vote 7 down vote accepted

The HTTP request is sent from Client to port 8080 of the Proxy Server. The Proxy Server then originates a new HTTP request to the destination site. The proxy, depending on the configuration, will often add a "X-Forwarded-For" header to the HTTP request. The log files on the destination web site will show the proxy's IP address, but may or may not be configured to log the "X-Forwarded-For" address.

That's the typical configuration, but proxy software will allow you all kinds of customization.

EDIT: I should note that when I originally read your question, I got the idea you were asking about an HTTP Proxy specifically, such as squid or nginx. There are many different types of proxies available. In Internet Explorer, you'll most likely be using an HTTP proxy, but there are many other types as well.

share|improve this answer
    
Yeah, it very much depends on the software you're using as a proxy server and how it is configured. See, e.g., the HttpProxyModule for Nginx: wiki.nginx.org/HttpProxyModule –  entropo Apr 1 '11 at 21:42
1  
If the request in sent to the proxy server only, how does the proxy know which destination address I want connect to? Does the proxy work at http level or at tcp level? –  cody Apr 1 '11 at 21:47
    
The browser making the request to the proxy requests the full URI. The proxy server then does the DNS lookup and originates it's own HTTP request to the target site. –  emgee Apr 1 '11 at 21:54
1  
A http proxy, like Squid (which I've been basing my answer on) works at the application layer. –  emgee Apr 2 '11 at 21:27
1  
@emgee: HTTP protocol also has a CONNECT method, so it is possible to connect through a HTTP proxy to a TCP server (if the proxy allows it) and that TCP server doesn't have to be a server that speaks HTTP. –  vtest Apr 2 '11 at 22:37

HTTP is a Layer 7 protocol so dont get confuse. when you use a HTTP proxy and you type say google.com , the HTTP header still same google.com, but the destination IP address will be IP address of the Proxy, source will be Hosts IP to the customized port number 8080.

share|improve this answer

There's no such thing as "tcp packet". TCP operates with data streams. There are IP packets.

You seem to be lacking some basic knowledge about networking, I suggest you to get a good book about TCP/IP. Everyone's favorite seems to be "TCP/IP illustrated" by W. Richard Stevens.

Back to your question.

A proxy is a middleman:

[you] - [proxy] - [server you want to connect]

Now there are two different connections:

[you] - (your connection to proxy) - [proxy] - (proxy's connection to server) - [server you want to connect]

When you think you're connecting to a server through a proxy, you're actually connecting to the proxy and tell it you want to reach a certain server. Then the proxy opens a second connection from itself to that server and acts as middleman passing data in both directions.

share|improve this answer
8  
A TCP packet is an IP packet with TCP header information in it. This is common parlance. Please don't be so condescendingly rude; it's only reflecting badly upon you, since you're also wrong at the same time. –  Phil P Apr 2 '11 at 22:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.