What is HTTP?
HTTP is really just text with a specific format being sent over TCP/IP. OK, so sometimes the server sends binary, for example an image. But requests are always text. So, a request comes in for a resource, say a web page. If you know what the request looks like (it’s text after all) you can find out what the client wants and return it. The response has a particular format as well. Think of it like a language. If you both speak the same language you’ll be able to understand one another. HTTP is really just a simple language.
The other thing to realize is that each request to the server is for a SINGLE resource. When a browser requests a web page and that page contains say lots of images, the server does NOT send them all at once. What happens is that the client requests the page which the server returns (only the page text, nothing else). Then the client (browser say) examines the source of the page that is returned and for each resource (eg an image) that is defined in the page (via an image tag say), the client requests that resource from the appropriate server. That server may be the same one the page came from, or it might be a totally different server.
The thing is that each element is being requested individually, the page and then the resources within it, one at a time from either the original server or other servers.
So from a server point of view, it has no idea WHY a client is requesting a resource, nor does it care. Each element request, including any original page or pages is completely independent and so is each response from the server.
Servers like Apache may have lots of options to analyze and process requests, and to format responses but essentially they do exactly the same thing. Examine the request, determine the resource to return and return it if it’s available or some response indicating why it isn’t (for example the famous HTTP 404 error, resource not found).