1

I have a product on a Raspberry Pi, using Raspbian where people connect to their Pi using WiFi served from the Pi, and then access the software via the web browser on their device (smartphone, tablet, computer) as a web app essentially.

However, when androids connect to the network it tries to connect to connectivitycheck.gstatic.com/generate_204 which returns a 204 - if it doesn't get back a 204 it assumes the connection needs logging in (via a portal etc) (ref)

How can I intercept queries to this address and then return the 204? The problem is that Android then remembers this as a "difficult" network and then lowers it's priorities for connection, and sometimes tries to reconnect several times in a frustrating way.

I'm looking for the simplest solution that ideally doesn't require any extra software installed, if this is possible.

0

I guess you already have apache running on the pi, right? If that's the case, you could hack your dns resolution (say, modifying dnsmasq config file... if you have it running on the pi) to make that domain resolve to the IP address of the rpi to the clients of the rpi. Then in apache, you could relatively easily program something (say.... a PHP script) so that you return a 204 when asking for that address. Not sure if returning the 204 would be possible with just Apache configuration. I'm sure there will be details to cover for but the basics sound solid to me.... that is, if it's using plain http. If it's checking with https, you are out of luck because you would also need certificates for the domain.

  • You'd need a local DNS server which points to the Raspberry Pi., easy enough to do, and a "VirtualHost"directive in a new configuration file in /etc/apache2/sites-enabled/. – NomadMaker Jul 29 '18 at 5:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.