As mentioned here since Android 5, when the device connect to. Wi-Fi network it makes a quick HTTP request to check if it has internet access.
This check is, for example, done with
clients3.google.com/generate_204
, a “webpage†that always returns
an HTTP status code 204 No Content| . Thus, if the device receives a
204` it is connected to the internet, otherwise it assumes that this
network does not provide proper internet access or is just a captive
portal.
Most probable resolution is to disable captive portal detection, ad there are a variety of ways to achieve this:
Using AdAway to prevent the HTTP leak (blocking the URL)
- Configuration of AdAway which blocks Google’s captive portal detection.
# captive portal
127.0.0.1
clients3.google.com
127.0.0.1
clients.l.google.com
- Disable captive portal detection
With a rooted phone you can simply disable captive portal detection. Just get a root-shell through adb (or SSH etc) to run the following command:
settings put global captive_portal_detection_enabled 0
Additionally see this related question: How to disable captive portal detection? How to remove exclamation mark on Wi-Fi or signal icon in Lollipop?
Change the server for captive portal detection using AdAway
Another option for changing the captive portal detection server is to change its IP address to one that’s under your control.
You can do that with AdAway, for example. Let’s say your captive portal detection server has the IP address 5.189.140.231
, then you may add the following to your AdAway configuration:
5.189.140.231 clients3.google.com
5.189.140.231 clients.l.google.com
The webserver at 5.189.140.231
should then of course accept requests for the foreign domains.
For other workarounds see here