Description
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: ESP-12-F
- Core Version: 2.6.3
- Development Env: Arduino IDE 1.8.12
- Operating System: Windows (using Android to connect)
Settings in IDE
- Module: Generic ESP8266 Module
- Flash Mode: dout
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method: nodemcu
- Flash Frequency: 40Mhz
- CPU Frequency: 80Mhz
- Upload Using: OTA
Problem Description
The CaptivePortal.ino and CaptivePortalAdvanced.ino examples only work on newer Android (phones and tablets) when the IP address of the esp8266 AP is set to that of Google.com
IPAddress apIP(172, 217, 28, 1);
If I enter any other other IP address there, the mobile device connects, but is not redirected to the captive portal login page. It just says there is no internet connection (while there actually is a local connection).
The problem doesn't show on IOS devices and Windows, only recent Android devices. So you could argue that it isn't an ESP8266 problem, but the purpose of this library/example is to serve those devices.
I tried many things, different IP and subnet ranges, DNS configurations, etc.
For example, adding a line to my code
webServer.on("/generate_204", []() { webServer.send(204, "text/html", "success"); });
removes the response that there is no internet connection, but still no portal login page is shown when connecting to the network. It only works when I use the specific IP address of Google, and I can imagine that that is not fully future-proof.
MCVE Sketch
Latest CaptivePortal.ino with the line
IPAddress apIP(172, 217, 28, 1);
changed into something else, like
IPAddress apIP(192, 168, 1, 1);