dpren
dpren

Reputation: 1305

Do resources in a URL path have their own IP address?

So, a DNS server recognizes https://www.google.com as 173.194.34.5

What does, say, https://www.google.com/images/srpr/logo11w.png look like to a server? Or are URL strings machine readable?

Upvotes: 3

Views: 1757

Answers (2)

Evert
Evert

Reputation: 99786

Good question!

When you access a url, first a DNS lookup will be done on the host part (www.google.com), after that the browser will look at the protocol and connect using that (https in this case).

After connecting, the browser will tell the server:

"Hi! I'm trying to connect to www.google.com and I would like the resource /images/srpr/logo11w.png). This looks like this on the protocol:

GET /images/srpr/logo11w.png HTTP/1.1
Host: www.google.com

The Host part is a HTTP header. There are usually more headers.

So the short answer is:

The server will get access to both the hostname, and the full path the browser tried to access.

Upvotes: 3

walther
walther

Reputation: 13600

https://www.google.com/images/srpr/logo11w.png

consists of several parts

  • protocol (https)
  • address of the server (www.google.com, that gets translated to IP)
  • path to the resource (/images/srpr/logo11w.png, in this example it seems like it would be an image in a directory srpr, which is in a directory images in the root of the website)

The server processes path to the resource the user requested (via GET method) based on various rules and returns a response.

Upvotes: 2

Related Questions