Anders Jakobsen
Anders Jakobsen

Reputation: 1095

Which changes do a browser make when using an HTTP Proxy?

Imagine a webbrowser that makes an HTTP request to a remote server, such as site.example.com

If the browser is then configured to use a proxy server, let's call it proxy.example.com using port 8080, in which ways are the request now different?

Obviously the request is now sent to proxy.example.com:8080, but there must surely be other changes to enable the proxy to make a request to the original url?

Upvotes: 0

Views: 153

Answers (2)

CodeCaster
CodeCaster

Reputation: 151720

RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing, Section 5.3.2. absolute-form:

When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client MUST send the target URI in absolute-form as the request-target.

absolute-form  = absolute-URI

The proxy is requested to either service that request from a valid cache, if possible, or make the same request on the client's behalf to either the next inbound proxy server or directly to the origin server indicated by the request-target. Requirements on such "forwarding" of messages are defined in Section 5.7.

An example absolute-form of request-line would be:

GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1

So, without proxy, the connection is made to www.example.org:80:

GET /pub/WWW/TheProject.html HTTP/1.1
Host: www.example.org

With proxy it is made to proxy.example.com:8080:

GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1
Host: www.example.org

Where in the latter case the Host header is optional (for HTTP/1.0 clients), and must be recalculated by the proxy anyway.

Upvotes: 1

deceze
deceze

Reputation: 522587

The proxy simply makes the request on behalf of the original client. Hence the name "proxy", the same meaning as in legalese. The browser sends their request to the proxy, the proxy makes a request to the requested server (or not, depending on whether the proxy wants to forward this request or deny it), the server returns a response to the proxy, the proxy returns the response to the original client. There's no fundamental difference in what the server will see, except for the fact that the originating client will appear to be the proxy server. The proxy may or may not alter the request, and it may or may not cache it; meaning the server may not receive a request at all if the proxy decides to deliver a cached version instead.

Upvotes: 1

Related Questions