I'm trying, with 0 success to bypass the captive portal on iOS. The web server is a Wemos ESP8266 based with WiFiManager.h lib, I've been working on the lib to suit my needs. One of the features implemented was printing the IP address of the board on HTML as soon as the board is set to a Wifi and then shutting down the WiFi signal of the board.
I manage successfully to redirect PC users to the desired page but I with captive portal is hard to archive such feature.
On my research I found this <html> success </html>
code to fool the captive into thinking I have an internet connection! but I fail to implement it properly.
Could some one help with this? how to handle the code correctly so the captive gets bypassed. Ty
Using the Arduino IDE/bootloader in setup() I do:
const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP("My Device SSID");
dnsServer.start(DNS_PORT, "*", apIP);
webServer.on("/hotspot-detect.html", handleAppleCaptivePortal);
webServer.begin();
Loop is just
void loop() {
dnsServer.processNextRequest();
webServer.handleClient();
}
The handler function looks like:
void handleAppleCaptivePortal() {
String Page = F("<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>");
webServer.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
webServer.sendHeader("Pragma", "no-cache");
webServer.sendHeader("Expires", "-1");
webServer.send(200, "text/html", Page);
return;
}
This seems to totally fake my iPhone out. It just connects to the network as if it had an Internet connection.