Captive portal public WiFi URLs

tl;dr: When connected to a captive portal, try visiting http://neverssl.com to trigger the portal.


Public WiFi often has captive portal login. Portals may coerce users to accept terms and conditions and absolution of liability before accessing the Internet. The portals may be worked around by DNS tunneling, MAC spoofing, etc. Many users just tolerate the portals.

Web browsers may try to trigger captive portals by checking servers, in case the OS hasn’t already triggered the captive portal. Sometimes captive portals aren’t triggered. HSTS blocks HTTP captive portal redirects. Try visiting a deliberately non-HTTPS portal-triggering site like http://neverssl.com

Devices on networks that block the platform’s automatic network checking may indicate like:

Connected, no Internet

If there’s not a captive sign-in webpage, the network connection may still work to non-Google sites.

Check connectivity manually using curl like:

curl -I -w "%{response_code}" http://neverssl.com
-I
show header only
-w "%{response_code}"
write the HTTP response code to console

Use cURL to check connectivity through captive portals

Return code 200:

  • Firefox
    curl -I -w "%{response_code}" http://detectportal.firefox.com/success.txt
  • Windows
    curl -I -w "%{response_code}" http://www.msftconnecttest.com/connecttest.txt
  • macOS
    curl -I -w "%{response_code}" http://captive.apple.com/hotspot-detect.html
  • Fedora
    curl -I -w "%{response_code}" http://fedoraproject.org/static/hotspot.txt

Return code 204:

  • Google
    curl -I -w "%{response_code}" http://connectivitycheck.gstatic.com/generate_204
  • Android
    curl -I -w "%{response_code}" http://connectivitycheck.android.com/generate_204
  • Ubuntu
    curl -I -w "%{response_code}" http://connectivity-check.ubuntu.com/generate_204

Python script to check connectivity through captive portals

Using Python requests, one can script testing of URLs with friendly feedback.

python ./captive_portal.py

Firefox: http://detectportal.firefox.com/success.txt returned 200
Windows: http://www.msftconnecttest.com/connecttest.txt returned 200
macOS: http://captive.apple.com/hotspot-detect.html returned 200
Fedora: http://fedoraproject.org/static/hotspot.txt returned 200
Google: http://connectivitycheck.gstatic.com/generate_204 returned 204
Android: http://connectivitycheck.android.com/generate_204 returned 204
Ubuntu: http://connectivity-check.ubuntu.com/generate_204 returned 204