I have been trying to build a captive portal in Apache that I plan to be Apple CNA aware.
I found several relevant posts in StackOverflow, including Captive portal popups... and How to create WiFi popup login page.
I defined the relevant Apache configuration as:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^CaptiveNetworkSupport(.*)$ [NC]
RewriteRule ^(.*)$ http://192.168.2.1/captive/portal.html [L,R=302]
# android
RedirectMatch 302 /generate_204 http://192.168.2.1/captive/portal.html
# windows
RedirectMatch 302 /ncsi.txt http://192.168.2.1/captive/portal.html
It is not working quite right, as the CNA browser enters a redirect loop.
I also tried putting all my relevant pages into a /captive directory, and defining the rule
RewriteRule !^captive($|/) http://192.168.2.1/captive/portal.html [L,R=302]
But had similar loop problems. What to do?
create_ap
to start network, which in turn deals withhostapd
anddnsmasq
. I wonder what the simplest solution would be for my use case https://unix.stackexchange.com/questions/446114/can-i-get-dnsmasq-to-drop-any-address-queries-it-does-not-know - it would be great to hear what you say. I thought what is left for me is to tweak iptables and apache. Thanks – r0berts May 31 '18 at 06:43