2

I have an access point hosting a login page (which doesn't have actual internet access) and I'm using dnsmasq to answer all DNS requests with the IP address of this page. If an android device connects, I want it to know that it's connected to a captive portal and show the "Sign-in to wifi network" prompt but this doesn't happen (the device just silently connects to the AP), although wireshark shows that the http GET requests for "/generate_204" are properly responded with "HTTP/1.1 200 OK". Any suggestions why this could be happening? Could there be something other than the response for "/generate_204" that android checks? I'm guessing that the detection fails if the device finds out that there's no internet access.

Thanks

  • Have you tried responding to the GET /generate_204 HTTP/1.1 request with a temporary redirect rather than 200? – kasperd Dec 30 '16 at 14:03
  • Yes I've tried a 302 response before. But then I found a working captive portal replying with 200. I've been trying it with 200 since then. – Awais Chishti Dec 30 '16 at 14:28
  • Don't attempt to respond to /generate_204 at all. Doing so tells the device that there is not a captive portal. You should simply return a 302 redirect to the captive portal. – Michael Hampton Dec 30 '16 at 19:00
  • @MichaelHampton That's not how /generate_204 works. When /generate_204 was introduced it was already common practice for captive portals to produce a redirect for anything. The idea of /generate_204 is to work with existing captive portals which redirects it without knowing that there is anything special about that URL. If there is no captive portal access to /generate_204 will receiver a 204 status code which is how devices know that there is no captive portal. – kasperd Dec 30 '16 at 23:38
  • 1
    It worked with a 200 response. I configured dnsmasq to reply with a random (non-local) IP instead of the server's IP. For the redirection I used iptables to forward all http requests to the local server instead. The sign-in prompt shows up now. – Awais Chishti Jan 3 '17 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.