/etc/hosts changes aren’t getting reflected on Mac


I've a Spring Boot application which uses an external service. I want to reproduce a scenario where that service is not reachable after my application is up and running.

So, I thought I'll start my service and update the /etc/hosts entry to block the outgoing calls to that service. Somehow this is not working for my Mac.

This is how the URL of that external service looks like:

pulsar+ssl://a943.chat.extservice.com:6951?preset=low_tp_no_read

And this is the entry of /etc/hosts:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

# Block external service calls
0.0.0.0         pulsar+ssl://a943.chat.extservice.com:6951?preset=low_tp_no_read
0.0.0.0         a943.chat.extservice.com
0.0.0.0         pulsar+ssl://a943.chat.extservice.com:6951
0.0.0.0         a943.chat.extservice.com:6951

I tried adding all possible combinations but this is not working. Even I blocked google.com, but still I was able to access it.

Any suggestions or help would be really appreciated.

Thanks!

Author: Subham

Leave a Reply

Your email address will not be published. Required fields are marked *