Skip to content

wifi manager seems to redirect to 0.0.0.0 for the CaptivePortal #1543

@EtoTen

Description

@EtoTen

Basic Infos

Hardware

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (2022.12.2) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash

WiFimanager Branch/Release: Master (latest from github not release)

Description

Problem description:

Everything seems to work, except I get redirected to 0.0.0.0 instead of the Captive Portal IP. I think the issue may have started after I upgraded to the 2022.12.2 release of the Espressif platform.

I identified the issue being at WifiManager.cpp, line 2403

  String serverLoc = toStringIp(server->client().localIP());
  if(_httpPort != 80) serverLoc += ":" + (String)_httpPort; // add port if not default
  bool doredirect = serverLoc != server->hostHeader(); // redirect if hostheader not server ip, prevent redirect loops

As a quick hack, this worked as a work arround:

  String serverLoc =  "192.168.4.1"
  if(_httpPort != 80) serverLoc += ":" + (String)_httpPort; // add port if not default
  bool doredirect = serverLoc != server->hostHeader(); // redirect if hostheader not server ip, prevent redirect loops

Settings in IDE

[env:node32s]
platform = espressif32
board = az-delivery-devkit-v4
board_build.mcu = esp32
board_build.f_cpu = 240000000L
framework = arduino
monitor_speed = 115200
upload_protocol = esptool
upload_flags =
--connect-attempts= 200
lib_deps =
paulstoffregen/Time@^1.6.1
jchristensen/Timezone@^1.2.4
plerup/EspSoftwareSerial@^6.15.2
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.0
lennarthennigs/Button2@^2.2.2
rpolitex/ArduinoNvs@^2.5
earlephilhower/ESP8266Audio@^1.9.7
fabianoriccardi/Melody Player@^2.4.0
https://github.com/tzapu/WiFiManager.git

Sketch

#BEGIN
#include <Arduino.h>
#include <driver/dac.h>

#include <WiFi.h>
#include <SPI.h>
#include <TimeLib.h>
#include <Time.h>
#include <Timezone.h>
#include <DNSServer.h>
#include <WebServer.h>

#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager

#include "LEDControl.h"
#include "SPI_Nixie_Interface.h"
#include "NTP_time.h"
#include "GPS_time.h"
#include "main.h"

#include <stdio.h>
#include <stdlib.h>

#include "ArduinoNvs.h"
#include "Button2.h"

void setup() {
  wifiManager.setHostname("redacted");
  wifiManager.setCountry("US");
  wifiManager.setDebugOutput(true);
  wifiManager.setConfigPortalBlocking(false);
  WiFi.setSleep(false);
  WiFi.setTxPower(WIFI_POWER_19_5dBm); // Set WiFi RF power output to highest level
  wifiManager.startConfigPortal(AP_NAME);
}

void loop() {
     wifiManager.process();
}
#END

Debug Messages

*wm:[2] <- Request redirected to captive portal 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugValidated BUG

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions