Android does not detect a captive portal 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.
I have this exact same setup and was having the same problem. I solved this by having the web server return some content as well as the status code. In my case, I had the web server respond with the index page for any requests not found on the web server.

Note that this is being done by an access point that does have internet access.