[GH-ISSUE #883] get only Request redirected to captive portal #746

Open
opened 2026-02-28 01:26:52 +03:00 by kerem · 8 comments
Owner

Originally created by @GvLente on GitHub (May 10, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/883

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • Development

Esp8266/Esp32:

  • ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • ESP12 E/F/S (nodemcu, wemos, feather)
  • Other

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • 2.4.0
  • staging (master/dev)

Description

Problem description

I get only Request redirected to captive portal serveral times after connection and more when i refresh the blanc html page

File Not Found
URI: /
Method: GET
Arguments : 0

Settings in IDE

Module: NodeMcu, Wemos D1 R2

17:09:17.123 -> *WM:
17:09:17.157 -> *WM: AutoConnect
17:09:17.157 -> *WM: Connecting as wifi client...
17:09:17.157 -> *WM: Using last saved values, should be faster
17:09:17.157 -> *WM: Connection result:
17:09:17.157 -> *WM: 0
17:09:17.157 -> *WM:
17:09:17.157 -> *WM: Configuring access point...
17:09:17.157 -> *WM: ESP8266
17:09:17.157 -> *WM: password
17:09:17.638 -> *WM: AP IP address:
17:09:17.638 -> *WM: 192.168.4.1
17:09:17.638 -> *WM: HTTP server started
17:09:23.432 -> *WM: Request redirected to captive portal
17:09:23.500 -> *WM: Request redirected to captive portal
17:09:29.368 -> *WM: Request redirected to captive portal
17:09:30.461 -> *WM: Request redirected to captive portal
etc.
etc. each time when i refresh

using Sketch: ESP8266_LED_Control_06_Station_Mode_with_mDNS_and_wifiManager

I dont get the wifimanager main page only get in android and apple a emty page with

File Not Found
URI: /
Method: GET
Arguments : 0

using Sketch: ESP8266_LED_Control_06_Station_Mode_with_mDNS_and_wifiManager

/*

  • Sketch: ESP8266_LED_Control_06_Station_Mode_with_mDNS_and_wifiManager
  • Control an LED from a web browser
  • Intended to be run on an ESP8266
    */

#include <ESP8266WiFi.h>
//#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>

// change these values to match your network
//char ssid[] = "MyNetwork_SSID"; // your network SSID (name)
//char pass[] = "Newtwork_Password"; // your network password

WiFiServer server(80);

String header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
String html_1 = "<html><head></head>

LED Control

";
String html_2 = "";
String html_4 = "
</html>";

String request = "";
int LED_Pin = D1;

void setup()
{
pinMode(LED_Pin, OUTPUT);

  Serial.begin(115200);
  delay(500);
  Serial.println(F("Serial started at 115200"));
  Serial.println();

  // We start by connecting to a WiFi network
  //Serial.print(F("Connecting to "));  Serial.println(ssid);
  //WiFi.begin(ssid, pass);

  //while (WiFi.status() != WL_CONNECTED) 
  //{
  //    Serial.print(".");    delay(500);
  //}
  //Serial.println("");
  //Serial.println(F("[CONNECTED]"));
  //Serial.print("[IP ");              
  //Serial.print(WiFi.localIP()); 
  //Serial.println("]");

 // WiFiManager
  WiFiManager wifiManager;
  wifiManager.autoConnect("ESP8266","password");


  // or use this for auto generated name ESP + ChipID
  //wifiManager.autoConnect();

  // if you get here you have connected to the WiFi
  Serial.println("Connected.");


  if (!MDNS.begin("esp8266"))   {  Serial.println("Error setting up MDNS responder!");  }
  else                          {  Serial.println("mDNS responder started");  }

  // start a server
  server.begin();
  Serial.println("Server started");

} // void setup()

void loop()
{

// Check if a client has connected
WiFiClient client = server.available();
//if (!client)  {  return;  }

if (client)
{
      // Read the first line of the request
      request = client.readStringUntil('\r');

      Serial.println("request:");
      Serial.println(request);

      if       ( request.indexOf("LEDON") > 0 )  { digitalWrite(LED_Pin, HIGH);  }
      else if  ( request.indexOf("LEDOFF") > 0 ) { digitalWrite(LED_Pin, LOW);   }


      // Get the LED pin status and create the LED status message
      if (digitalRead(LED_Pin) == HIGH) 
      {
          // the LED is on so the button needs to say turn it off
         html_2 = "<form id='F1' action='LEDOFF'><input class='button' type='submit' value='Turn off the LED' ></form><br>";
      }
      else                              
      {
          // the LED is off so the button needs to say turn it on
          html_2 = "<form id='F1' action='LEDON'><input class='button' type='submit' value='Turn on the LED' ></form><br>";
      }


      client.flush();

      client.print( header );
      client.print( html_1 );    
      client.print( html_2 );
      client.print( html_4);

      delay(5);

     // The client will actually be disconnected when the function returns and 'client' object is detroyed

}

} // void loop()

Originally created by @GvLente on GitHub (May 10, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/883 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [x] Master - [ ] Development **Esp8266/Esp32:** - [x] ESP8266 - [ ] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [x] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [ ] 2.4.0 - [x] staging (master/dev) ### Description Problem description I get only Request redirected to captive portal serveral times after connection and more when i refresh the blanc html page File Not Found URI: / Method: GET Arguments : 0 ### Settings in IDE Module: NodeMcu, Wemos D1 R2 17:09:17.123 -> *WM: 17:09:17.157 -> *WM: AutoConnect 17:09:17.157 -> *WM: Connecting as wifi client... 17:09:17.157 -> *WM: Using last saved values, should be faster 17:09:17.157 -> *WM: Connection result: 17:09:17.157 -> *WM: 0 17:09:17.157 -> *WM: 17:09:17.157 -> *WM: Configuring access point... 17:09:17.157 -> *WM: ESP8266 17:09:17.157 -> *WM: password 17:09:17.638 -> *WM: AP IP address: 17:09:17.638 -> *WM: 192.168.4.1 17:09:17.638 -> *WM: HTTP server started 17:09:23.432 -> *WM: Request redirected to captive portal 17:09:23.500 -> *WM: Request redirected to captive portal 17:09:29.368 -> *WM: Request redirected to captive portal 17:09:30.461 -> *WM: Request redirected to captive portal etc. etc. each time when i refresh using Sketch: ESP8266_LED_Control_06_Station_Mode_with_mDNS_and_wifiManager I dont get the wifimanager main page only get in android and apple a emty page with File Not Found URI: / Method: GET Arguments : 0 using Sketch: ESP8266_LED_Control_06_Station_Mode_with_mDNS_and_wifiManager /* * Sketch: ESP8266_LED_Control_06_Station_Mode_with_mDNS_and_wifiManager * Control an LED from a web browser * Intended to be run on an ESP8266 */ #include <ESP8266WiFi.h> //#include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> #include <ESP8266WiFi.h> #include <ESP8266mDNS.h> // change these values to match your network //char ssid[] = "MyNetwork_SSID"; // your network SSID (name) //char pass[] = "Newtwork_Password"; // your network password WiFiServer server(80); String header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; String html_1 = "<!DOCTYPE html><html><head><meta name='viewport' content='width=device-width, initial-scale=1.0'/><meta charset='utf-8'><style>body {font-size:140%;} #main {display: table; margin: auto; padding: 0 10px 0 10px; } h2,{text-align:center; } .button { padding:10px 10px 10px 10px; width:100%; background-color: #4CAF50; font-size: 120%;}</style><title>LED Control</title></head><body><div id='main'><h2>LED Control</h2>"; String html_2 = ""; String html_4 = "</div></body></html>"; String request = ""; int LED_Pin = D1; void setup() { pinMode(LED_Pin, OUTPUT); Serial.begin(115200); delay(500); Serial.println(F("Serial started at 115200")); Serial.println(); // We start by connecting to a WiFi network //Serial.print(F("Connecting to ")); Serial.println(ssid); //WiFi.begin(ssid, pass); //while (WiFi.status() != WL_CONNECTED) //{ // Serial.print("."); delay(500); //} //Serial.println(""); //Serial.println(F("[CONNECTED]")); //Serial.print("[IP "); //Serial.print(WiFi.localIP()); //Serial.println("]"); // WiFiManager WiFiManager wifiManager; wifiManager.autoConnect("ESP8266","password"); // or use this for auto generated name ESP + ChipID //wifiManager.autoConnect(); // if you get here you have connected to the WiFi Serial.println("Connected."); if (!MDNS.begin("esp8266")) { Serial.println("Error setting up MDNS responder!"); } else { Serial.println("mDNS responder started"); } // start a server server.begin(); Serial.println("Server started"); } // void setup() void loop() { // Check if a client has connected WiFiClient client = server.available(); //if (!client) { return; } if (client) { // Read the first line of the request request = client.readStringUntil('\r'); Serial.println("request:"); Serial.println(request); if ( request.indexOf("LEDON") > 0 ) { digitalWrite(LED_Pin, HIGH); } else if ( request.indexOf("LEDOFF") > 0 ) { digitalWrite(LED_Pin, LOW); } // Get the LED pin status and create the LED status message if (digitalRead(LED_Pin) == HIGH) { // the LED is on so the button needs to say turn it off html_2 = "<form id='F1' action='LEDOFF'><input class='button' type='submit' value='Turn off the LED' ></form><br>"; } else { // the LED is off so the button needs to say turn it on html_2 = "<form id='F1' action='LEDON'><input class='button' type='submit' value='Turn on the LED' ></form><br>"; } client.flush(); client.print( header ); client.print( html_1 ); client.print( html_2 ); client.print( html_4); delay(5); // The client will actually be disconnected when the function returns and 'client' object is detroyed } } // void loop()
Author
Owner

@GvLente commented on GitHub (May 10, 2019):

sorry i am not familiar with github

<!-- gh-comment-id:491373345 --> @GvLente commented on GitHub (May 10, 2019): sorry i am not familiar with github
Author
Owner

@GvLente commented on GitHub (May 10, 2019):

AutoConnectWithTimeout.ino

gives in serial:
20:08:22.105 -> *WM: AutoConnect
20:08:22.105 -> *WM: Connecting as wifi client...
20:08:22.105 -> *WM: Using last saved values, should be faster
20:08:22.105 -> *WM: Connection result:
20:08:22.105 -> *WM: 0
20:08:22.105 -> *WM:
20:08:22.105 -> *WM: Configuring access point...
20:08:22.105 -> *WM: AutoConnectAP
20:08:22.615 -> *WM: AP IP address:
20:08:22.615 -> *WM: 192.168.4.1
20:08:22.615 -> *WM: HTTP server started
20:08:34.265 -> *WM: Request redirected to captive portal
20:08:46.222 -> *WM: Request redirected to captive portal
20:08:47.343 -> *WM: Request redirected to captive portal
20:08:47.411 -> *WM: Request redirected to captive portal

in the browser a blanc page

a refresh gives only more *WM: Request redirected to captive portal

<!-- gh-comment-id:491382064 --> @GvLente commented on GitHub (May 10, 2019): AutoConnectWithTimeout.ino gives in serial: 20:08:22.105 -> *WM: AutoConnect 20:08:22.105 -> *WM: Connecting as wifi client... 20:08:22.105 -> *WM: Using last saved values, should be faster 20:08:22.105 -> *WM: Connection result: 20:08:22.105 -> *WM: 0 20:08:22.105 -> *WM: 20:08:22.105 -> *WM: Configuring access point... 20:08:22.105 -> *WM: AutoConnectAP 20:08:22.615 -> *WM: AP IP address: 20:08:22.615 -> *WM: 192.168.4.1 20:08:22.615 -> *WM: HTTP server started 20:08:34.265 -> *WM: Request redirected to captive portal 20:08:46.222 -> *WM: Request redirected to captive portal 20:08:47.343 -> *WM: Request redirected to captive portal 20:08:47.411 -> *WM: Request redirected to captive portal in the browser a blanc page a refresh gives only more *WM: Request redirected to captive portal
Author
Owner

@tablatronix commented on GitHub (May 10, 2019):

might be a bug that was fixed in development branch already, not sure

<!-- gh-comment-id:491400035 --> @tablatronix commented on GitHub (May 10, 2019): might be a bug that was fixed in development branch already, not sure
Author
Owner

@GvLente commented on GitHub (May 11, 2019):

ok, I tryd development 0.14 there was the same result

<!-- gh-comment-id:491494852 --> @GvLente commented on GitHub (May 11, 2019): ok, I tryd development 0.14 there was the same result
Author
Owner

@dontsovcmc commented on GitHub (May 19, 2019):

It's better to use Wireshark to sniff requests..

I got same infinitive *WM: Request redirected to captive portal when connected to ESP by MacOS with running virtual Windows7. When I turn off Windows7 (Parallels), ESP web server works great. It means there are some unknown requests, that DDOS ESP server.

<!-- gh-comment-id:493716166 --> @dontsovcmc commented on GitHub (May 19, 2019): It's better to use Wireshark to sniff requests.. I got same infinitive `*WM: Request redirected to captive portal` when connected to ESP by MacOS with running virtual Windows7. When I turn off Windows7 (Parallels), ESP web server works great. It means there are some unknown requests, that DDOS ESP server.
Author
Owner

@tablatronix commented on GitHub (May 19, 2019):

.14 is not development branch

<!-- gh-comment-id:493766934 --> @tablatronix commented on GitHub (May 19, 2019): .14 is not development branch
Author
Owner

@tablatronix commented on GitHub (May 19, 2019):

It is more likely that the host is ignoring the dns responses, but yeah you need to wireshark this to figure it out for sure.

<!-- gh-comment-id:493767070 --> @tablatronix commented on GitHub (May 19, 2019): It is more likely that the host is ignoring the dns responses, but yeah you need to wireshark this to figure it out for sure.
Author
Owner

@GvLente commented on GitHub (May 20, 2019):

Which is the development branch?
I will whireshark and see whats going wrong thanks voor the lead and the good work

<!-- gh-comment-id:493885105 --> @GvLente commented on GitHub (May 20, 2019): Which is the development branch? I will whireshark and see whats going wrong thanks voor the lead and the good work
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#746
No description provided.