I have a lightweight linux device which I would like to block from accessing one specific URL. Instead of making the request to the external URL, I would like to return the contents of a local file.
The most common solutions for accomplishing this seem to be:
- Using squid (not suitable because the required resources are not available)
- DNS blocking using /etc/hosts (not suitable because I only want to block a specific url, not an entire domain)
I am unsure whether this can be done solely using iptables? Are there any other simple solutions?
Any suggestions are appreciated. Thanks.