http://www.gstatic.com/generate_204 opening up for no reason in Chrome

Solution 1:

Tl;Dr This happens on misconfigured networks and fluctuating/unstable connections. Chrome is tricked into 'thinking' that there is a webpage on the network, that the user needs to login to, in order to access internet.

From my experience, the GStatic page appears on chrome when the computer's internet connection is down. When Chrome fails loading a website, it checks a website which doesn't use Https, in order to test the network's status: http://gstatic.com

  • If the request to GStatic fails, Chrome will throw an error, Like Internet Disconnected.

  • If the request to GStatic returns a 204 No Content Response, then it is means the user has working Internet.

  • If the request to GStatic comes from a different IP and or, is different to what Chrome expects the real website to be, Chrome will think there is a captive portal, (eg. Some page like on public Wi-Fis where the user is asked to further login/Accept ToS.)

    • If Chrome thinks the network has a captive portal, it will open that page, for the user to login with more simplicity. However, for example, my router has a fluctuating internet connection in my area. Chrome might as a result fail to load a website immediately, and will be greeted by an error code from my router. Chrome will be tricked and think it is a Captive Portal. By the time, google show me the Login page, Internet is back, thus the empty page.

Edit: Many browsers has their own 'Generate_204' websites like Xiaomi's Web Browser: http://connect.rom.miui.com/generate_204.

As chrome opens the GStatic on a new tab, the tab with the website I was trying to load shows: Connect to Wi-Fi: The Wi-Fi that you are using (Cuala_566) may require you to visit its login page.

Solution 2:

In my case the problem was an invalid self-signed SSL certificate for the site I was visiting. I was deploying a webapp into ISS in a server and this error was shown, when I clicked "Connect" the http://www.gstatic.com/generate_204 issue showed up.

The issue occurs only by using Chrome or Edge (It didn't occur when using FireFox or IE11). The issue got fixed by generating a valid self-signed certificate. According to this answer, Chrome apparently needs the following two attributes to work: Authority Key Identifier and Basic Constraints

I managed to make it work by generating the certificate using the http://keystore-explorer.org tool by following the steps from this answer: https://stackoverflow.com/a/48688789/1657465