Reputation: 21
I have created a custom captive portal (externally hosted, made with PHP) on Ubiquity Unifi infrastructure. Everything works fine, except:
Apple devices (OSX, iOS) don't get the usual popup with the captive portal upon connection.
My employer requires this to happen. Any ideas?
Upvotes: 1
Views: 6667
Reputation: 11
I just realized that this issue can also happen if in the advanced network configuration you have configured a custom DNS IP address.
Check and to fix, simply go to
System Preferences -> Network -> WiFi -> Advanced… -> DNS
and see if there are only IPs that are greyed out (good) or if you have IPs in normal (bright) letters (bad)
If you find custom configured IPs, just click on each and the “-“ button at the bottom left of the window.
Upvotes: 0
Reputation: 21
I solved my own question based on: https://serverfault.com/questions/679393/captive-portal-popups-the-definitive-guide
iOS and OSX devices make a request to a URL to detect captive portals. The rules are the following:
- GET/POST http://foo.com/bar.html
- If bar.html == [expected content] > Open Internet
- If bar.html != [expected content] > Captive Portal
- If bar.html[status] != SUCCESS > No Network
However, I was redirecting users using an HTTP header when they first hit the captive portal. This does not fall into any of the above rules and therefore prevented Apple devices from detecting that there was a captive portal.
Here is my final code, which redirects to my portal from a weird URL that the hotspot gives:
<?php
/* Trying to get Apple to show the WiFi popup */
if (!empty($_REQUEST['url']) && (strstr($_REQUEST['url'],'success.html') || strstr($_REQUEST['url'],'detect.html'))) {
echo '
Redirecting...
<script type="text/javascript">
window.location = "/index.html";
</script>';
exit;
}
header("Location:/index.html?". $_SERVER['QUERY_STRING']);
As you can see, Apple devices need to see some actual content, not a redirect.
I also rewrite the .php file extensions as .html.
Hope this helps somebody else.
Upvotes: 0