ESP32 AsyncWebServer host connection issue from Galaxy S21

I have a large project working fine with the ESP32 AsyncWebServer host allowing connections (one at a time) via WiFi from:

  1. Google Pixel
  2. IPhone
  3. Windows Desktop

However, a Galaxy S21 refuses to receive a webpage from the host after an a reported successful connection. The Galaxy shows "Connected without Internet" which is what all the other devices that work also shows.

The ESP32 is setup as a password protected Soft AP.

I have been working with the server for several weeks and it works fine on all of the above device, except for when I try to connect with the Galaxy S21.

All the steps below have been tried on the Galaxy have been tried, such as:
1) Forget network
2) ReAdd network
3) Turn off encryption (set to none, but it seems to end up showing WPA2 once connected)
4) Tried using both Chrome and Firefox on the Galaxy and both show same issue of hanging when trying to receive home page.

Note: There are no cookies to clear as I am not sending any from the host.

Does anyone have any ideas on what the issue may be with it connecting to the network on this specific device, yet failing to receive a webpage? Any help is very much appreciated.

Thank you!

The below code prints the message "Received client request for home page" whenever a device connects, except from the Galaxy S21 running Chrome and Firefox browsers.

So, the issue seems to be occurring at a lower level which appears to be blocking the request from getting to the server.on("/"... portion of the code.

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){

    Serial.println("Received client request for home page");

    strcpy(Dynamic_Web_Page, MAIN_HEADER__BODY_FOOTER);

    request->send(200, "text/html", Dynamic_Web_Page);
  });

I'm not an android user, but when you connect to a WiFi network, the system tries to detect whether the network actually has internet access. It does this by making an HTTP request to a known URL, usually http://connectivitycheck.gstatic.com/generate_204 .

Android expects the code 204 response. If it doesn’t get a 204, the OS assumes the network has no internet and may block or delay normal browsing, showing “Connected without Internet.”

if you try this code

#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>

const char* ssid = "ESP32-AP";
const char* password = "12345678";

AsyncWebServer server(80);

void setup() {
  WiFi.softAP(ssid, password);

  server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(200, "text/html", "<html><body><h1>Hello Galaxy S21!</h1></body></html>");
  });

  // ====> Try to respond to Android connectivity check (there is no DNS so we should see the request)
  server.on("/generate_204", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(204);
  });

  server.begin();
}

void loop() {}

do you see a greeting message on your Galaxy S21?


may be you need a DNS to get the request routed to the ESP32, then it would be something like

#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <DNSServer.h>

const char* ssid = "ESP32-AP";
const char* password = "12345678";
IPAddress apIP(192, 168, 4, 1);

AsyncWebServer server(80);
DNSServer dnsServer;

void setup() {
  WiFi.softAP(ssid, password);
  WiFi.softAPConfig(apIP, apIP, IPAddress(255,255,255,0));

  // Redirect all DNS queries to the ESP32
  dnsServer.start(53, "*", apIP);

  // Respond to Android connectivity check
  server.on("/generate_204", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(204);
  });

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(200, "text/html", "<html><body><h1>Hello Galaxy S21!</h1></body></html>");
  });

  server.begin();
}

void loop() {
  dnsServer.processNextRequest();
}

Sometimes newer phones (like the Galaxy S21) have stricter Wi-Fi handling that causes trouble with ESP32’s AsyncWebServer. A few things you can try:

  • Make sure the ESP32 is running on 2.4GHz Wi-Fi (the S21 may default to 5GHz).
  • Disable mobile data temporarily to force the phone to stay on the ESP32 network.
  • If you’re running in AP mode, ensure your IP/subnet settings don’t clash.
  • For STA mode, check that the router isn’t blocking the ESP32 or isolating clients.

If it works fine from a PC but not from the S21, it’s usually a Wi-Fi band or captive portal handling issue.

I located the issue on the Galaxy. This particular phone had a work VPN installed for their employer. Even though mobile data and internet were turned off and inaccessible, the VPN was set to on and, as expected, not connecting.

So the Galaxy was attempting to serve the ESP32 webpage via the VPN, which was spinning its wheels trying to access the internet.

THANK you for the quick responses! I did not know about the 204 response and will be congnizant of that going forward. I am currently running the mDNS and that is working fine now on the Galaxy as well.

Thanks again for the excellent help!

Glad you found the solution. I’m guessing you are using the ESP32 as a hot spot. If so the following issue may crop up:

I have a project using “ESP32 AsyncWebServer host” that creates a hot spot. All the clients have to connect their device’s WiFi to that hot spot to access the ESP32’s web server.

I found that my Galaxy didn’t close the socket to the ESP32 before switching WiFi to some other SSID. My laptop and iPad do close the socket in that situation. I found this problem when that client’s web socket got full of periodic status messages from my ESP32 code. I was sending the same message to all clients. A short while after switching WiFi connections on the Galaxy, my ESP32 code almost ground to a halt. I fixed it by sending to individual clients and closing any offending clients’ sockets.

[Edit to clarify “Galaxy didn’t close the socket to the ESP32 before switching WiFi“ This problem doesn’t happen if one manually closes any ESP32 web pages that are open on the client. It only happens when changing WiFi from the ESP32 hot spot to some other SSID with one or more ESP32 web pages open in the browser]

Thanks for the info! That would be a definite gotcha issue in the future use of the server.