Access by Hostname

Hello! I have a question and I don’t know if it’s possible to do this. What I would like to do was block access using my public IP and release access using my ddns hostname.

in theory it would be like this

block access on public ip 192.168.1.50 example
accept access on my hostname ph.paulo.com.br example

You’re asking about application layer filtering … which ROS mostly can not do.