[GH-ISSUE #658] ESP32 - WebServer not reachable in AP STA mode in Win10 #552

Open
opened 2026-02-28 01:25:50 +03:00 by kerem · 13 comments
Owner

Originally created by @Mirdox on GitHub (Jul 14, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/658

Hardware

WiFimanager Branch/Release: Development

Esp32:
WROOM32

Description

Hello there,

I'm facing really weird issue and I'm not sure what is it related to.
When WiFi is not configured, everything is working as expected.
After the WiFi is configured and the ESP32 goes to AP STA mode, the WebServer (OnDemand Portal) cannot be accessed by some devices.
Computer with Windows 10 cannot access the web server, never, while the same computer with Ubuntu can access the web server.
Computer with Windows 7 can always access the WebServer, Android phone can sometimes access the Webserver.
All devices are for sure connected to ESP access point, but the web service isn't simple there. I've tried also with telnet.

Does anybody have this issue?
Any Ideas?

Thank you

Sketch

Advanced Example Sketch

Originally created by @Mirdox on GitHub (Jul 14, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/658 #### Hardware WiFimanager Branch/Release: Development Esp32: WROOM32 ### Description Hello there, I'm facing really weird issue and I'm not sure what is it related to. When WiFi is not configured, everything is working as expected. After the WiFi is configured and the ESP32 goes to AP STA mode, the WebServer (OnDemand Portal) cannot be accessed by some devices. Computer with Windows 10 cannot access the web server, never, while the same computer with Ubuntu can access the web server. Computer with Windows 7 can always access the WebServer, Android phone can sometimes access the Webserver. All devices are for sure connected to ESP access point, but the web service isn't simple there. I've tried also with telnet. Does anybody have this issue? Any Ideas? Thank you ### Sketch Advanced Example Sketch
Author
Owner

@tablatronix commented on GitHub (Jul 14, 2018):

Are you sure the configportal is running ?
Do you mean the captive portal doesn't work , what happens if you use ip address?

What does serial say?

<!-- gh-comment-id:405051708 --> @tablatronix commented on GitHub (Jul 14, 2018): Are you sure the configportal is running ? Do you mean the captive portal doesn't work , what happens if you use ip address? What does serial say?
Author
Owner

@Mirdox commented on GitHub (Jul 14, 2018):

Hello,

The configportal is running, because I'm able to access it from another clients, e.g. Win7 or Linux.
It isn't problem of the captive portal, i'm only using ip address to access the configportal.

The serial says nothing, no debug messages when I'm trying to open configportal from Win10 computer or android phone.
I've also tried to disable FW, so this should not be the issue.
It looks like there is no service listening. I was trying telnet, nmap port scan, browser.
The Win10 and Android is for sure connected to the AP, I've add debug messages for that.

When I disconnect the ESP32 from network, the configportal is accessible.

The on demand config portal is also accessible when I add
wm.disconnect();
before
wm.startConfigPortal("OnDemandAP");
but that's just a workarround.

Thanks for quick response.

<!-- gh-comment-id:405053132 --> @Mirdox commented on GitHub (Jul 14, 2018): Hello, The configportal is running, because I'm able to access it from another clients, e.g. Win7 or Linux. It isn't problem of the captive portal, i'm only using ip address to access the configportal. The serial says nothing, no debug messages when I'm trying to open configportal from Win10 computer or android phone. I've also tried to disable FW, so this should not be the issue. It looks like there is no service listening. I was trying telnet, nmap port scan, browser. The Win10 and Android is for sure connected to the AP, I've add debug messages for that. When I disconnect the ESP32 from network, the configportal is accessible. The on demand config portal is also accessible when I add wm.disconnect(); before wm.startConfigPortal("OnDemandAP"); but that's just a workarround. Thanks for quick response.
Author
Owner

@tablatronix commented on GitHub (Jul 14, 2018):

Ok was just making sure you were not connecting to the esp softap that it runs on boot if persistent saved it. Then of course webserver is not available.

<!-- gh-comment-id:405054090 --> @tablatronix commented on GitHub (Jul 14, 2018): Ok was just making sure you were not connecting to the esp softap that it runs on boot if persistent saved it. Then of course webserver is not available.
Author
Owner

@tablatronix commented on GitHub (Jul 14, 2018):

build_flags = -DESP32 -DCORE_DEBUG_LEVEL=5 might help

So what exactly is in the wm logs

<!-- gh-comment-id:405054202 --> @tablatronix commented on GitHub (Jul 14, 2018): `build_flags = -DESP32 -DCORE_DEBUG_LEVEL=5` might help So what exactly is in the wm logs
Author
Owner

@tablatronix commented on GitHub (Jul 14, 2018):

There are some known issue with android security and captive portal, but if accessing via ip it has been known to work. I do not have windows 10 here, but I have used it fairly recently and do not recall any issues. I will try to fire up my vm

<!-- gh-comment-id:405054526 --> @tablatronix commented on GitHub (Jul 14, 2018): There are some known issue with android security and captive portal, but if accessing via ip it has been known to work. I do not have windows 10 here, but I have used it fairly recently and do not recall any issues. I will try to fire up my vm
Author
Owner

@Mirdox commented on GitHub (Jul 15, 2018):

Hello,

I've tried core debug before with no success and I've reproduced it now. Maybe you will notice something.
Maybe this issue is OS related, but the weird thing is, that I'm not able to connect to config portal only in AP STA mode, when STA is disconnected, it works as expected.

 Starting
*WM: Added Parameter: customfield
*WM: AutoConnect 
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 0 - WIFI_READY
*WM: ESP32 event handler enabled[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 14 - AP_STOP
 
*WM: Connecting as wifi client... 
*WM: Connecting to saved AP: ROUTER_AP
*WM: connectTimeout not set, ESP waitForConnectResult... 
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:386] _eventCallback(): STA IP: 192.168.1.105, MASK: 255.255.255.0, GW: 192.168.1.1
*WM: Connection result: WL_CONNECTED
*WM: AutoConnect: SUCCESS 
*WM: STA IP Address: 192.168.1.105
connected...yeey :)


Here I've pressed the button

Starting config portal
*WM: Enabling AP 
*WM: StartAP with SSID:  OnDemandAP
*WM: AP has anonymous access! 
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START
*WM: AP IP address: 192.168.4.1
*WM: Starting Web Portal 
*WM: HTTP server started 
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 1 - SCAN_DONE
*WM: WiFi Scan done 
*WM: Config Portal Running, blocking, waiting for clients...

Here I've connected Android phone and opened 192.168.4.1

[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 15 - AP_STACONNECTED
*WM: Portal Timeout In 109 seconds
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 17 - AP_STAIPASSIGNED
*WM: <- HTTP Root 
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 1 - SCAN_DONE
*WM: WiFi Scan done 
[I][WiFiClient.cpp:443] connected(): Disconnected: RES: 0, ERR: 128
*WM: <- Request redirected to captive portal 
[I][WiFiClient.cpp:443] connected(): Disconnected: RES: 0, ERR: 128

Here I've connected Windows 10 computer and opened 192.168.4.1, no further logs

*WM: Portal Timeout In 110 seconds
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 15 - AP_STACONNECTED
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 17 - AP_STAIPASSIGNED
*WM: Portal Timeout In 80 seconds
*WM: Portal Timeout In 50 seconds

What you mean by:

Ok was just making sure you were not connecting to the esp softap that it runs on boot if persistent saved it. Then of course webserver is not available.

? Maybe I'm missing something.

Thank you

<!-- gh-comment-id:405073767 --> @Mirdox commented on GitHub (Jul 15, 2018): Hello, I've tried core debug before with no success and I've reproduced it now. Maybe you will notice something. Maybe this issue is OS related, but the weird thing is, that I'm not able to connect to config portal only in AP STA mode, when STA is disconnected, it works as expected. ``` Starting *WM: Added Parameter: customfield *WM: AutoConnect [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 0 - WIFI_READY *WM: ESP32 event handler enabled[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 14 - AP_STOP *WM: Connecting as wifi client... *WM: Connecting to saved AP: ROUTER_AP *WM: connectTimeout not set, ESP waitForConnectResult... [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 4 - STA_CONNECTED [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 7 - STA_GOT_IP [D][WiFiGeneric.cpp:386] _eventCallback(): STA IP: 192.168.1.105, MASK: 255.255.255.0, GW: 192.168.1.1 *WM: Connection result: WL_CONNECTED *WM: AutoConnect: SUCCESS *WM: STA IP Address: 192.168.1.105 connected...yeey :) ``` Here I've pressed the button ``` Starting config portal *WM: Enabling AP *WM: StartAP with SSID: OnDemandAP *WM: AP has anonymous access! [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 14 - AP_STOP [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 13 - AP_START *WM: AP IP address: 192.168.4.1 *WM: Starting Web Portal *WM: HTTP server started [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 1 - SCAN_DONE *WM: WiFi Scan done *WM: Config Portal Running, blocking, waiting for clients... ``` Here I've connected Android phone and opened 192.168.4.1 ``` [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 15 - AP_STACONNECTED *WM: Portal Timeout In 109 seconds [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 17 - AP_STAIPASSIGNED *WM: <- HTTP Root [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 1 - SCAN_DONE *WM: WiFi Scan done [I][WiFiClient.cpp:443] connected(): Disconnected: RES: 0, ERR: 128 *WM: <- Request redirected to captive portal [I][WiFiClient.cpp:443] connected(): Disconnected: RES: 0, ERR: 128 ``` Here I've connected Windows 10 computer and opened 192.168.4.1, no further logs ``` *WM: Portal Timeout In 110 seconds [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 15 - AP_STACONNECTED [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 17 - AP_STAIPASSIGNED *WM: Portal Timeout In 80 seconds *WM: Portal Timeout In 50 seconds ``` What you mean by: > Ok was just making sure you were not connecting to the esp softap that it runs on boot if persistent saved it. Then of course webserver is not available. ? Maybe I'm missing something. Thank you
Author
Owner

@tablatronix commented on GitHub (Jul 15, 2018):

usually the opposite is true, when in sta ap mode and sta is failing it fails to work.

Are you saying the opposite when connected to your ap and running configportal ( sta+ap ) your connects fail sometimes?

It sounds like a channel issue.
Have you pulled in the most recent commits for esp32?

<!-- gh-comment-id:405097166 --> @tablatronix commented on GitHub (Jul 15, 2018): usually the opposite is true, when in sta ap mode and sta is failing it fails to work. Are you saying the opposite when connected to your ap and running configportal ( sta+ap ) your connects fail sometimes? It sounds like a channel issue. Have you pulled in the most recent commits for esp32?
Author
Owner

@tablatronix commented on GitHub (Jul 15, 2018):

The esp clearly shows your sta connecting to it, hmm it does seem like your client will not make the http request, maybe it is a firewall or security issue.

I will keep testing, but it does in fact seem like a client issue, maybe check wireshark?

<!-- gh-comment-id:405097454 --> @tablatronix commented on GitHub (Jul 15, 2018): The esp clearly shows your sta connecting to it, hmm it does seem like your client will not make the http request, maybe it is a firewall or security issue. I will keep testing, but it does in fact seem like a client issue, maybe check wireshark?
Author
Owner

@Mirdox commented on GitHub (Jul 15, 2018):

Yes, connecting to AP fails sometimes.
I'm using the most up-to-date version.

Wireshark was a good idea, but still no clue what is going on.

When STA is disconnected, the client (Win10) makes some initial handshake with ESP32:
random client port -> esp port 80 - SYN
esp port 80 -> random client port - SYN-ACK
random client port -> esp port 80 - ACK
HTTP GET REQUEST after this handshake
Just like described here http://blog.catchpoint.com/2010/09/17/anatomyhttp/

When STA is connected, the client (Win10) fails to make this initial handshake while trying to connect to ESP32.
Win10 sends the first SYN, but no SYN-ACK is received from ESP.

I believe the ESP32 doesn't send this SYN-ACK in some cases.

I will try to compare it with Win7 later.

Have you experienced this before?

Thank you

<!-- gh-comment-id:405121217 --> @Mirdox commented on GitHub (Jul 15, 2018): Yes, connecting to AP fails sometimes. I'm using the most up-to-date version. Wireshark was a good idea, but still no clue what is going on. When STA is disconnected, the client (Win10) makes some initial handshake with ESP32: random client port -> esp port 80 - SYN esp port 80 -> random client port - SYN-ACK random client port -> esp port 80 - ACK HTTP GET REQUEST after this handshake Just like described here http://blog.catchpoint.com/2010/09/17/anatomyhttp/ When STA is connected, the client (Win10) fails to make this initial handshake while trying to connect to ESP32. Win10 sends the first SYN, but no SYN-ACK is received from ESP. I believe the ESP32 doesn't send this SYN-ACK in some cases. I will try to compare it with Win7 later. Have you experienced this before? Thank you
Author
Owner

@tablatronix commented on GitHub (Jul 15, 2018):

Ooh could it have something to do with the ip address? Different class when on the 2 networks.

<!-- gh-comment-id:405122202 --> @tablatronix commented on GitHub (Jul 15, 2018): Ooh could it have something to do with the ip address? Different class when on the 2 networks.
Author
Owner

@Mirdox commented on GitHub (Jul 17, 2018):

IP address, mask, default gateway seem to be OK.
Also ip routing is identical with computer on which it works without issues.

Thank you for help, don't waste time with it.

<!-- gh-comment-id:405683994 --> @Mirdox commented on GitHub (Jul 17, 2018): IP address, mask, default gateway seem to be OK. Also ip routing is identical with computer on which it works without issues. Thank you for help, don't waste time with it.
Author
Owner

@tablatronix commented on GitHub (Jul 17, 2018):

I don't mean there is something wrong I mean the computer is refusing to connect to that ip address for security reasons due the ip class itself.

what ip classes are on your 2 networks ?

Yeah this almost sounds like a esp bug, but to test you would need to use the webserver example and test in sta and ap mode, without wifimanager being involved.

<!-- gh-comment-id:405693040 --> @tablatronix commented on GitHub (Jul 17, 2018): I don't mean there is something wrong I mean the computer is refusing to connect to that ip address for security reasons due the ip class itself. what ip classes are on your 2 networks ? Yeah this almost sounds like a esp bug, but to test you would need to use the webserver example and test in sta and ap mode, without wifimanager being involved.
Author
Owner

@Mirdox commented on GitHub (Jul 17, 2018):

On station I'm using 192.168.1.x

On AP, I've now tried some more ip configs.
10.0.1.1
192.168.2.1
192.168.4.1
Win10 didn't work, Win7 worked on all of them, Android worked only on 192.168.4.1.

Thanks, I'll try pure webserver.

<!-- gh-comment-id:405697914 --> @Mirdox commented on GitHub (Jul 17, 2018): On station I'm using 192.168.1.x On AP, I've now tried some more ip configs. 10.0.1.1 192.168.2.1 192.168.4.1 Win10 didn't work, Win7 worked on all of them, Android worked only on 192.168.4.1. Thanks, I'll try pure webserver.
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#552
No description provided.