How to block an app's access to a specific website using the hosts file? I want to block an app from connecting to a specific website using the hosts file. How can I do that?

Is something like this possible:

127.0.0.1     foo.com:spotify
The hosts file is used by the system and can't be used to restrict access for specific apps.

See I&#39;m trying to block game &quot;X&quot; from accessing the internet including updating for alternative software which is able to block specific apps from accessing specific sites.