When the server receives a request, does it automatically knows the website is itself? [closed]

My website URL is modified for access from remote systems like this:

//var url = "http://127.0.0.1:5000/dosomething"
var url = "http://www.somewebsite.com/dosomething"

The URL is used by the Python backend and JS front end. When the server receives a request, does it automatically know www.somewebsite.com is itself?


It knows automatically when it receives this detail in the Host field of the HTTP request header. But as a server can be called by just its IP, this is not always the case. So you need to know the agent.

You should remember though an IP can host multiple virtual hosts and there is no one-to-one mapping between a domain and an IP. In fact it can be even many-to-many.