iptables: Whitelist a specific URL and not just the domain

How would I whitelist a specific URL with iptables? Currently all requests are blocked.

IE: http://www.apple.com/library/test/success.html

I need to whitelist just this URL so that my captive portal does not trigger the Captive Network Assistant on the iPad. Ideally still blocking requests to www.apple.com.

Additionally, is there a way to make the rule specific to a certain User-Agent?

Thanks!


Solution 1:

You need a HTTP proxy. It is impossible to do this with iptables only.

Block access to all HTTP hosts (except of your proxy) with iptables, for all except of the proxy. Then configure the proxy to allow or deny specific URLs.