Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 Captive Portal not loading on Android #553

Open
fcjr opened this issue Mar 14, 2018 · 23 comments
Open

ESP32 Captive Portal not loading on Android #553

fcjr opened this issue Mar 14, 2018 · 23 comments
Labels
DEV Help Wanted Developer Needs Help ESP32 Esp 32 related issue Needs Feeback Developer needs feedback

Comments

@fcjr
Copy link

fcjr commented Mar 14, 2018

Basic Infos

Hi,
I just pulled the latest development build of WiFiManager (as well as the latest version of the Arduino-ESP32 core which includes the latest DNSServer library (as suggested in espressif/arduino-esp32#1186), however when running The AutoConnect Example (and others) I do not get a captive portal on any device. On Windows 10 and macOS (both latest) I am able to navigate to 192.168.4.1 or another non https page and it resolves to the ESP32, however no captive portal pops up on load. On android (8.1.0, latest) the issue seems to be more problematic, the device does not see any internet connection so it defaults to LTE and does not allow navigation to the ESP32 (even though it stays connected to the AP).

Are there some configuration steps I might be missing?

Thanks! - FC

Hardware

WiFimanager Branch/Release: Development

Hardware: espressif ESP32 DevKitC

Core Version: latest

@tablatronix
Copy link
Collaborator

Dnsserver is no longer required, use the one in core

@fcjr
Copy link
Author

fcjr commented Mar 14, 2018

Hey @tablatronix, thanks for the reply! I am using the DNSServer library from the core, I am using the latest version of the core and am having the results stated above.

@tablatronix
Copy link
Collaborator

tablatronix commented Mar 14, 2018

confirmed, captiveportal in ondemand config portal works, autoconnect does not.
Should be something dumb, will fix

@tablatronix
Copy link
Collaborator

nope nevermind, I had the configportal timeout to short

@tablatronix
Copy link
Collaborator

cant reproduce, windows 10 and IOS, both redirect to captive portal.

What do your logs show ?

@tablatronix tablatronix added ESP32 Esp 32 related issue and removed ESP32 Esp 32 related issue labels Mar 14, 2018
@fcjr
Copy link
Author

fcjr commented Mar 24, 2018

Hi @tablatronix, thanks for your reply. I realized that the issue on my mac and pc was due to my antivirus blocking captive portals. (Sorry about that!) However there still seems to be an issue with android devices finding the captive portal. I've tried on both a Google Pixel and a Galaxy S8.

The Debug output simply states the following on connect:
*WM: NUM CLIENTS: 0
*WM: NUM CLIENTS: 1

The devices do seem to be getting the dns information properly however (see examples from pixel at end of this post). When attempting to navigate to a non https page (using chrome), or even directly via 192.168.4.1, the phones don't seem to even be making requests to the ESP. I have tested the devices on other captive portal systems (such as the guest wifi functionality on my home router, and both android phones pick up those portals fine).

If there is any more information I may be able to give you to help determine the problem please let me know!

networksettings
noconnection
noconnection2

@fcjr fcjr changed the title ESP32 Captive Portal not loading, multiple OSes ESP32 Captive Portal not loading on Android Mar 24, 2018
@tablatronix
Copy link
Collaborator

I do not have an android device to test unfortunately. I will try to obtain one.
When I had that problem it was a dns issue or firewall issue, Ill take a look at wireshark and see if everything looks ok, but its working for me everytime.

@tablatronix tablatronix added DEV Help Wanted Developer Needs Help Needs Feeback Developer needs feedback labels Mar 24, 2018
@treii28
Copy link

treii28 commented Apr 1, 2018

I've also been experiencing this trouble for some time. I have plenty of extra systems, wifi adapters, etc. around as well as multiple android and other devices. (no iOS but I can gain access to some if needed). I've been needing a pop-up style portal for over a year and have been searching and/or posting occasionally to try to find a solution.
I see the 'help wanted' and 'Needs Feedback'. I've only tinkered with wireshark a little, but if you can give me an idea what you want to see, I will do anything I can to get you data.

@nicogon
Copy link

nicogon commented Apr 2, 2018

On android only works if you try to open a http page (not https). And is not automatic as in ios or a pc.
I've been researching about this, and it seems the problem is that android dont like that captive portal ip is in the same network. i've tested with a functional captive portal that dns resolves correctly (for android captive https://www.gstatic.com/generate_204 as an external ip) but it seems there is some kind of http redirection of the request to the captive portal.

@nicogon
Copy link

nicogon commented Apr 2, 2018

dns service should give an external ip and then do some kind of http redirection (that i havent been able to do it with esp8266). Do you know if there is a way of intercepting http packet to an external ip and deliver a 302 redirection to the captive portal?

@tablatronix
Copy link
Collaborator

Yeah I will keep tracking this here espressif/arduino-esp32#1037 (comment)
no need to continue posting here, as this is clearly not a wm issue.

I will keep it open in case we can find a workaround or solution for us, then update the captiveportal examples and vice versa.

I don't understand why this stuff is hard to come by, there should just be a developer whitepaper on this for andoid that clearly specifies what the deal is and how to get captive portals working.

@nicogon
Copy link

nicogon commented Apr 21, 2018

Got it working on android by setting AP IP host to 172.217.28.1 (like if it was a wan ip) and network mask to 255.255.255.0.
I got the popup woking on android 7 (Samsung S7), Iphone 7 and OSX.

@JohnnyPP
Copy link

@nicogon How did you exactly do it? I have been struggling with this problem for about two months.

@treii28
Copy link

treii28 commented Apr 29, 2018

I think the gist of it is that whatever the device will reject local IP dns responses for addresses it knows - or at least rejects local ips it knows for something it knows should be on the internet at large.
I've been trying to find either a code example or even a written explanation of just what things like OpenWRT do to make them work. My suspicion is that they don't simply redirect DNS like the arduino/esp code used to do but instead it actually intercepts internet traffic going to any other address than it's own and answers it as though it were the address in question.
Part of the problem on things like OpenWRT is that the people programming it aren't even 100% sure of the whole process because they rely on other people's tools such as IPTables to do some of the dirty work for them such as re-routing the packets. All they need to do then is answer them.
The ESP code core has lwip in with it to handle the IP stack. If I could find a good code example somewhere, I might be able to stab blindly around in the dark with my limited knowledge of C++ to try to do something similar until a given client was properly re-directed.

@tablatronix
Copy link
Collaborator

Anyone figure anything new out?

@mattncsu
Copy link

mattncsu commented Aug 6, 2018

On your Android device, go to Advanced wifi options and disable the option to "Switch to mobile data - Switch to mobile data whenever your Wi-Fi internet connection is slow or unstable."

@hualde
Copy link

hualde commented Sep 23, 2018

P

@kbickham
Copy link

I got this working by setting ip to 8.8.8.8 ot 8.8.4.4 and using port 53

@nabeelkirmani
Copy link

nabeelkirmani commented Nov 26, 2019

Workaround

In file WiFiManager.cpp, in function void WiFiManager::handleNotFound() replacing the 400 response code to 200 at Line 738 i.e.

replacing server->send ( 404, "text/plain", message );
with server->send ( 200, "text/plain", message );

solves the issue of pop-up not appearing on my Windows 10 device. I tested this on the AutoConnect example in Sloeber IDE on NodeMCU 1.0 board.

I don't know why it worked but it did, and if someone can explain kindly do.

Whereas for my Android P & Windows 10 devices,
CaptivePortal.ino sketch works and brings up the pop-up captive portal.

@tablatronix
Copy link
Collaborator

Thats interesting indeed, all requests should return the portal if its active..
Do you have or can you obtain serial logs of this ?

That handler should never be reached.

@nabeelkirmani
Copy link

nabeelkirmani commented Nov 27, 2019

Thats interesting indeed, all requests should return the portal if its active..
Do you have or can you obtain serial logs of this ?

That handler should never be reached.

On building the project in the previously mentioned environment -

10:33:20 **** Incremental Build of configuration Release for project tzapu ****
"C:\\Sloeber\\arduinoPlugin\\tools\\make\\make" all 
'Do all objcopy commands'
"C:\Sloeber\arduinoPlugin\packages\esp8266\tools\python3\3.7.2-post1/python3" "C:\Sloeber\/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.1/tools/elf2bin.py" --eboot "C:\Sloeber\/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.1/bootloaders/eboot/eboot.elf" --app "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.elf" --flash_mode dio --flash_freq 40 --flash_size 4M --path "C:\Sloeber\arduinoPlugin\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin" --out "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.bin"
Creating BIN file "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.bin" using "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.elf"
"C:\Sloeber\arduinoPlugin\packages\esp8266\tools\python3\3.7.2-post1/python3" "C:\Sloeber\/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.1/tools/signing.py" --mode sign --privatekey "/private.key" --bin "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.bin" --out "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.bin.signed" --legacy "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.bin.legacy_sig"
"C:\Sloeber\arduinoPlugin\packages\esp8266\tools\python3\3.7.2-post1/python3" "C:\Sloeber\/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.1/tools/sizes.py" --elf "C:\Users\nabeel\Documents\sloeber-wrkspc\tzapu/Release/tzapu.elf" --path "C:\Sloeber\arduinoPlugin\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin"
Executable segment sizes:

IROM   : 276360          - code in flash         (default or ICACHE_FLASH_ATTR) 

IRAM   : 26716   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 

DATA   : 1244  )         - initialized variables (global, static) in RAM/HEAP 

RODATA : 2068  ) / 81920 - constants             (global, static) in RAM/HEAP 

BSS    : 29360 )         - zeroed variables      (global, static) in RAM/HEAP 

'Finished building: tzapu.hex'
' '
'Building target: tzapu'
'Printing size:'
"C:\Sloeber\arduinoPlugin\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin/xtensa-lx106-elf-size" -A "C:/Users/nabeel/Documents/sloeber-wrkspc/tzapu/Release/tzapu.elf"
C:/Users/nabeel/Documents/sloeber-wrkspc/tzapu/Release/tzapu.elf  :
section                                                                                                                                                      size         addr
.data                                                                                                                                                        1244   1073643520
.noinit                                                                                                                                                         4   1073644764
.text                                                                                                                                                         252   1074790400
.irom0.text                                                                                                                                                276360   1075843088
.text1                                                                                                                                                      26464   1074790652
.rodata                                                                                                                                                      2068   1073644768
.bss                                                                                                                                                        29360   1073646840
.debug_frame                                                                                                                                                47664            0
.debug_info                                                                                                                                               1152832            0
.debug_abbrev                                                                                                                                              121376            0
.debug_aranges                                                                                                                                              13344            0
.debug_ranges                                                                                                                                               30688            0
.debug_line                                                                                                                                                276298            0
.debug_str                                                                                                                                                 232529            0
.comment                                                                                                                                                     4680            0
.xtensa.info                                                                                                                                                   56            0
.xt.lit._ZN16esp8266webserver14RequestHandlerI10WiFiServerED2Ev                                                                                                 8            0
.xt.lit._ZN16esp8266webserver14RequestHandlerI10WiFiServerED0Ev                                                                                                 0            0
.xt.lit._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE9canUploadE6String                                                                           0            0
.xt.lit._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE9canHandleE10HTTPMethod6String                                                               0            0
.xt.lit._ZNSt14_Function_base13_Base_managerISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvvEEPS3_EEE10_M_managerERSt9_Any_dataRKSB_St18_Manager_operation               0            0
.xt.lit._ZNSt14_Function_base13_Base_managerISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvbEEPS3_bEEE10_M_managerERSt9_Any_dataRKSB_St18_Manager_operation              0            0
.xt.lit._ZNSt14_Function_base13_Base_managerIN16esp8266webserver14nullArgHandlerEE10_M_managerERSt9_Any_dataRKS4_St18_Manager_operation                         0            0
.xt.lit._ZNSt14_Function_base13_Base_managerIN16esp8266webserver15storeArgHandlerI10WiFiServerEEE10_M_managerERSt9_Any_dataRKS6_St18_Manager_operation          0            0
.xt.lit._ZNK6String10startsWithEPK19__FlashStringHelper                                                                                                         0            0
.xt.lit._ZNK6String9substringEj                                                                                                                                 0            0
.xt.lit._ZN6String7replaceEPKcRKS_                                                                                                                              0            0
.xt.lit._ZN6String7replaceEPKcS1_                                                                                                                               0            0
.xt.lit._ZNK6String6lengthEv                                                                                                                                    0            0
.xt.lit._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerED2Ev                                                                                         8            0
.xt.lit._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerED0Ev                                                                                         0            0
.xt.lit._ZNSt8functionIFvvEEC2ISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvvEEPS5_EEvEET_                                                                              8            0
.xt.lit._ZNSt8functionIFvvEEC2ISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvbEEPS5_bEEvEET_                                                                             8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE10sendHeaderERK6StringS5_b                                                                 8            0
.xt.lit._ZNK16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE3argERK6String                                                                            8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE2onERK6StringSt8functionIFvvEE                                                             0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15RequestArgumentD2Ev                                                                      0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15RequestArgumentC2Ev                                                                      0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE14_collectHeaderEPKcS4_                                                                    0            0
.xt.lit._ZNKSt8functionIFvvEEclEv                                                                                                                               8            0
.xt.lit._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE6handleERNS_24ESP8266WebServerTemplateIS1_EE10HTTPMethod6String                              8            0
.xt.lit._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE6uploadERNS_24ESP8266WebServerTemplateIS1_EE6StringR10HTTPUpload                             0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE20responseCodeToStringEi                                                                   8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE14_prepareHeaderER6StringiPKcj                                                             8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE22_parseArgumentsPrivateERK6StringSt8functionIFvRS3_S7_S5_iiiiEE                           0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15_parseArgumentsERK6String                                                                8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15_uploadReadByteER10WiFiClient                                                            0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE23_parseFormUploadAbortedEv                                                                0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE16_uploadWriteByteEh                                                                       8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE10_parseFormER10WiFiClientRK6Stringj                                                       8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE13_parseRequestER10WiFiClient                                                              8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE9urlDecodeERK6String                                                                       8            0
.xt.lit._ZNSt17_Function_handlerIFvR6StringS1_RKS0_iiiiEN16esp8266webserver15storeArgHandlerI10WiFiServerEEE9_M_invokeERKSt9_Any_dataS1_S1_S3_iiii              0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerED2Ev                                                                                       8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE11sendContentERK6String                                                                    8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE4sendEiPKcRK6String                                                                        0            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE14_handleRequestEv                                                                         8            0
.xt.lit._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE12handleClientEv                                                                           8            0
.xt.prop._ZN16esp8266webserver14RequestHandlerI10WiFiServerE9canHandleE10HTTPMethod6String                                                                     36            0
.xt.prop._ZN16esp8266webserver14RequestHandlerI10WiFiServerE6handleERNS_24ESP8266WebServerTemplateIS1_EE10HTTPMethod6String                                    36            0
.xt.prop._ZN16esp8266webserver14RequestHandlerI10WiFiServerED2Ev                                                                                               48            0
.xt.prop._ZN16esp8266webserver14RequestHandlerI10WiFiServerE9canUploadE6String                                                                                 36            0
.xt.prop._ZN16esp8266webserver14RequestHandlerI10WiFiServerE6uploadERNS_24ESP8266WebServerTemplateIS1_EE6StringR10HTTPUpload                                   36            0
.xt.prop._ZNSt17_Function_handlerIFvR6StringS1_RKS0_iiiiEN16esp8266webserver14nullArgHandlerEE9_M_invokeERKSt9_Any_dataS1_S1_S3_iiii                           36            0
.xt.prop._ZN16esp8266webserver14RequestHandlerI10WiFiServerED0Ev                                                                                               48            0
.xt.prop._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE9canUploadE6String                                                                         60            0
.xt.prop._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE9canHandleE10HTTPMethod6String                                                             48            0
.xt.prop._ZNSt14_Function_base13_Base_managerISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvvEEPS3_EEE10_M_managerERSt9_Any_dataRKSB_St18_Manager_operation             96            0
.xt.prop._ZNSt14_Function_base13_Base_managerISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvbEEPS3_bEEE10_M_managerERSt9_Any_dataRKSB_St18_Manager_operation            96            0
.xt.prop._ZNSt14_Function_base13_Base_managerIN16esp8266webserver14nullArgHandlerEE10_M_managerERSt9_Any_dataRKS4_St18_Manager_operation                       96            0
.xt.prop._ZNSt14_Function_base13_Base_managerIN16esp8266webserver15storeArgHandlerI10WiFiServerEEE10_M_managerERSt9_Any_dataRKS6_St18_Manager_operation        96            0
.xt.prop._ZNSt17_Function_handlerIFvvESt5_BindIFSt7_Mem_fnIM11WiFiManagerFvvEEPS3_EEE9_M_invokeERKSt9_Any_data                                                 48            0
.xt.prop._ZNSt17_Function_handlerIFvvESt5_BindIFSt7_Mem_fnIM11WiFiManagerFvbEEPS3_bEEE9_M_invokeERKSt9_Any_data                                                36            0
.xt.prop._ZNK6String10startsWithEPK19__FlashStringHelper                                                                                                       48            0
.xt.prop._ZNK6String9substringEj                                                                                                                               72            0
.xt.prop._ZN6String7replaceEPKcRKS_                                                                                                                            48            0
.xt.prop._ZN6String7replaceEPKcS1_                                                                                                                             48            0
.xt.prop._ZNK6String6bufferEv                                                                                                                                  48            0
.xt.prop._ZNK6String6lengthEv                                                                                                                                  72            0
.xt.prop._ZNSt14_Function_baseD2Ev                                                                                                                             36            0
.xt.prop._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerED2Ev                                                                                       48            0
.xt.prop._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerED0Ev                                                                                       48            0
.xt.prop._ZNSt8functionIFvvEEC2ISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvvEEPS5_EEvEET_                                                                            48            0
.xt.prop._ZNSt8functionIFvvEEC2ISt5_BindIFSt7_Mem_fnIM11WiFiManagerFvbEEPS5_bEEvEET_                                                                           48            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE10sendHeaderERK6StringS5_b                                                               72            0
.xt.prop._ZNK16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE3argERK6String                                                                         144            0
.xt.prop._ZNSt8functionIFvvEEC2ERKS1_                                                                                                                          36            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE2onERK6StringSt8functionIFvvEE                                                           72            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15RequestArgumentD2Ev                                                                    48            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15RequestArgumentC2Ev                                                                    48            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE14_collectHeaderEPKcS4_                                                                  96            0
.xt.prop._ZNKSt8functionIFvvEEclEv                                                                                                                             60            0
.xt.prop._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE6handleERNS_24ESP8266WebServerTemplateIS1_EE10HTTPMethod6String                            60            0
.xt.prop._ZN16esp8266webserver22FunctionRequestHandlerI10WiFiServerE6uploadERNS_24ESP8266WebServerTemplateIS1_EE6StringR10HTTPUpload                           60            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE20responseCodeToStringEi                                                               1296            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE14_prepareHeaderER6StringiPKcj                                                           96            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE22_parseArgumentsPrivateERK6StringSt8functionIFvRS3_S7_S5_iiiiEE                        204            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15_parseArgumentsERK6String                                                             108            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE15_uploadReadByteER10WiFiClient                                                         144            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE23_parseFormUploadAbortedEv                                                              48            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE16_uploadWriteByteEh                                                                     48            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE10_parseFormER10WiFiClientRK6Stringj                                                    852            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE13_parseRequestER10WiFiClient                                                           576            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE9urlDecodeERK6String                                                                     96            0
.xt.prop._ZNSt17_Function_handlerIFvR6StringS1_RKS0_iiiiEN16esp8266webserver15storeArgHandlerI10WiFiServerEEE9_M_invokeERKSt9_Any_dataS1_S1_S3_iiii            60            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerED2Ev                                                                                    120            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE11sendContentERK6String                                                                  48            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE4sendEiPKcRK6String                                                                      60            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE14_handleRequestEv                                                                      108            0
.xt.prop._ZN16esp8266webserver24ESP8266WebServerTemplateI10WiFiServerE12handleClientEv                                                                        252            0
.xt.prop._ZTVN16esp8266webserver14RequestHandlerI10WiFiServerEE                                                                                                12            0
.xt.prop._ZTVN16esp8266webserver22FunctionRequestHandlerI10WiFiServerEE                                                                                        12            0
.xt.prop._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE0EED2Ev                                                                                              36            0
.xt.lit._ZNSt10_List_baseISt10shared_ptrI22WiFiEventHandlerOpaqueESaIS2_EE8_M_clearEv                                                                           0            0
.xt.prop._ZNSt10_List_baseISt10shared_ptrI22WiFiEventHandlerOpaqueESaIS2_EE8_M_clearEv                                                                         72            0
.xt.prop._ZSt4swapISt9_Any_dataEvRT_S2_                                                                                                                        36            0
.xt.lit._ZN10DataSourceD2Ev                                                                                                                                     8            0
.xt.lit._ZN16BufferDataSourceD2Ev                                                                                                                               0            0
.xt.lit._ZN10DataSourceD0Ev                                                                                                                                     0            0
.xt.lit._ZN16BufferDataSourceD0Ev                                                                                                                               0            0
.xt.lit._ZN16BufferDataSource10get_bufferEj                                                                                                                     8            0
.xt.lit._ZN16BufferDataSource14release_bufferEPKhj                                                                                                              8            0
.xt.lit._ZN13ClientContext7_s_pollEPvP7tcp_pcb                                                                                                                  0            0
.xt.lit._ZN13ClientContext7_s_recvEPvP7tcp_pcbP4pbufl                                                                                                           0            0
.xt.lit._ZN13ClientContext12_s_connectedEPvP7tcp_pcbl                                                                                                           8            0
.xt.lit._ZN24BufferedStreamDataSourceI13ProgmemStreamE14release_bufferEPKhj                                                                                     8            0
.xt.lit._ZN24BufferedStreamDataSourceI13ProgmemStreamE10get_bufferEj                                                                                            8            0
.xt.lit._ZN13ClientContext8_s_errorEPvl                                                                                                                         0            0
.xt.lit._ZN13ClientContext8_s_ackedEPvP7tcp_pcbt                                                                                                                0            0
.xt.lit._ZN13ClientContext5unrefEv                                                                                                                              0            0
.xt.lit._ZN13ClientContext15wait_until_sentEi                                                                                                                   0            0
.xt.lit._ZN13ClientContext11_write_someEv                                                                                                                       0            0
.xt.lit._ZN13ClientContext18_write_from_sourceEP10DataSource                                                                                                    8            0
.xt.lit._ZN13ClientContext8_consumeEj                                                                                                                           0            0
.xt.lit._ZN10WiFiClient5flushEv                                                                                                                                 0            0
.xt.lit._ZN10WiFiClient4stopEv                                                                                                                                  0            0
.xt.lit._ZNSt10unique_ptrIA_hSt14default_deleteIS0_EED2Ev                                                                                                       0            0
.xt.lit._ZN24BufferedStreamDataSourceI13ProgmemStreamED2Ev                                                                                                      0            0
.xt.lit._ZN24BufferedStreamDataSourceI13ProgmemStreamED0Ev                                                                                                      0            0
.xt.prop._ZN6Stream9readBytesEPhj                                                                                                                              36            0
.xt.prop._ZN10DataSourceD2Ev                                                                                                                                   48            0
.xt.prop._ZN16BufferDataSource9availableEv                                                                                                                     36            0
.xt.prop._ZN16BufferDataSourceD2Ev                                                                                                                             48            0
.xt.prop._ZN24BufferedStreamDataSourceI13ProgmemStreamE9availableEv                                                                                            36            0
.xt.prop._ZN10DataSourceD0Ev                                                                                                                                   48            0
.xt.prop._ZN16BufferDataSourceD0Ev                                                                                                                             48            0
.xt.prop._ZN16BufferDataSource10get_bufferEj                                                                                                                   48            0
.xt.prop._ZN16BufferDataSource14release_bufferEPKhj                                                                                                            48            0
.xt.prop._ZN13ClientContext7_s_pollEPvP7tcp_pcb                                                                                                                48            0
.xt.prop._ZN13ClientContext7_s_recvEPvP7tcp_pcbP4pbufl                                                                                                        108            0
.xt.prop._ZN13ClientContext12_s_connectedEPvP7tcp_pcbl                                                                                                         60            0
.xt.prop._ZN24BufferedStreamDataSourceI13ProgmemStreamE14release_bufferEPKhj                                                                                   72            0
.xt.prop._ZN24BufferedStreamDataSourceI13ProgmemStreamE10get_bufferEj                                                                                         120            0
.xt.prop._ZN13ClientContext8_s_errorEPvl                                                                                                                       60            0
.xt.prop._ZN13ClientContext8_s_ackedEPvP7tcp_pcbt                                                                                                              48            0
.xt.prop._ZN13ClientContext5unrefEv                                                                                                                            72            0
.xt.prop._ZN13ClientContext15wait_until_sentEi                                                                                                                120            0
.xt.prop._ZN13ClientContext11_write_someEv                                                                                                                    180            0
.xt.prop._ZN13ClientContext18_write_from_sourceEP10DataSource                                                                                                 252            0
.xt.prop._ZN13ClientContext8_consumeEj                                                                                                                         96            0
.xt.prop._ZN10WiFiClient5flushEv                                                                                                                               48            0
.xt.prop._ZN10WiFiClient4stopEv                                                                                                                                48            0
.xt.prop._ZNSt10unique_ptrIA_hSt14default_deleteIS0_EED2Ev                                                                                                     48            0
.xt.prop._ZN24BufferedStreamDataSourceI13ProgmemStreamED2Ev                                                                                                    48            0
.xt.prop._ZN24BufferedStreamDataSourceI13ProgmemStreamED0Ev                                                                                                    48            0
.xt.prop._ZTV10DataSource                                                                                                                                      12            0
.xt.prop._ZTV16BufferDataSource                                                                                                                                12            0
.xt.prop._ZTV24BufferedStreamDataSourceI13ProgmemStreamE                                                                                                       12            0
.xt.prop._ZTV10WiFiClient                                                                                                                                      12            0
.xt.lit._ZN10WiFiServerD2Ev                                                                                                                                     0            0
.xt.lit._ZN10WiFiServerD0Ev                                                                                                                                     0            0
.xt.prop._ZN5Print5flushEv                                                                                                                                     36            0
.xt.prop._ZN10WiFiServerD2Ev                                                                                                                                   48            0
.xt.prop._ZN10WiFiServerD0Ev                                                                                                                                   48            0
.xt.prop._ZTV10WiFiServer                                                                                                                                      12            0
.xt.lit._ZN3UDPD2Ev                                                                                                                                             8            0
.xt.lit._ZN3UDPD0Ev                                                                                                                                             0            0
.xt.lit._ZN10UdpContext7_s_recvEPvP7udp_pcbP4pbufPK8ip4_addrt                                                                                                   8            0
.xt.lit._ZN10UdpContextC2Ev                                                                                                                                     0            0
.xt.lit._ZN10UdpContext5unrefEv                                                                                                                                 0            0
.xt.prop._ZN3UDPD2Ev                                                                                                                                           48            0
.xt.prop._ZN7WiFiUDP4readEPcj                                                                                                                                  36            0
.xt.prop._ZN3UDPD0Ev                                                                                                                                           48            0
.xt.prop._ZN10UdpContext7_s_recvEPvP7udp_pcbP4pbufPK8ip4_addrt                                                                                                 96            0
.xt.prop._ZN10UdpContextC2Ev                                                                                                                                   48            0
.xt.prop._ZN10UdpContext5unrefEv                                                                                                                               60            0
.xt.prop._ZTV3UDP                                                                                                                                              12            0
.xt.prop._ZTV7WiFiUDP                                                                                                                                          12            0
.xt.lit._ZN14HardwareSerialD2Ev                                                                                                                                 8            0
.xt.lit._ZN14HardwareSerialD0Ev                                                                                                                                 0            0
.xt.lit._ZN14HardwareSerial4peekEv                                                                                                                              0            0
.xt.lit._ZN14HardwareSerial4readEv                                                                                                                              0            0
.xt.lit._ZN14HardwareSerial5writeEh                                                                                                                             0            0
.xt.lit._ZN14HardwareSerial5writeEPKhj                                                                                                                          0            0
.xt.prop._ZN14HardwareSerialD2Ev                                                                                                                               48            0
.xt.prop._ZN14HardwareSerial9readBytesEPhj                                                                                                                     36            0
.xt.prop._ZN14HardwareSerialD0Ev                                                                                                                               48            0
.xt.prop._ZN14HardwareSerial4peekEv                                                                                                                            48            0
.xt.prop._ZN14HardwareSerial4readEv                                                                                                                            48            0
.xt.prop._ZN14HardwareSerial5writeEh                                                                                                                           48            0
.xt.prop._ZN14HardwareSerial5writeEPKhj                                                                                                                        48            0
.xt.prop.6                                                                                                                                                     72            0
.xt.prop._ZTV14HardwareSerial                                                                                                                                  12            0
.xt.prop._ZTV9IPAddress                                                                                                                                        12            0
.xt.lit._ZN5Print5writeEPKc                                                                                                                                     8            0
.xt.prop._ZN5Print5writeEPKc                                                                                                                                   60            0
.xt.prop._ZN5Print5writeEc                                                                                                                                     36            0
.xt.prop._ZTV6Stream                                                                                                                                           12            0
.xt.prop._ZTV12StreamString                                                                                                                                    12            0
.xt.lit._ZN6String4initEv                                                                                                                                       0            0
.xt.prop._ZNK6String3lenEv                                                                                                                                     60            0
.xt.prop._ZN6String6setLenEi                                                                                                                                   60            0
.xt.prop._ZNK6String7wbufferEv                                                                                                                                 48            0
.xt.prop._ZN6String4initEv                                                                                                                                     48            0
.xt.lit.0                                                                                                                                                       8            0
.xt.lit.uart_rx_available_unsafe                                                                                                                                8            0
.xt.lit.1                                                                                                                                                       8            0
.xt.lit.uart_tx_fifo_available                                                                                                                                  0            0
.xt.prop.0                                                                                                                                                     48            0
.xt.prop.uart_rx_buffer_available_unsafe                                                                                                                       48            0
.xt.prop.uart_rx_available_unsafe                                                                                                                              48            0
.xt.prop.1                                                                                                                                                     96            0
.xt.prop.uart_tx_fifo_available                                                                                                                                48            0
.xt.lit._ZNKSt8functionIFbvEEclEv                                                                                                                               0            0
.xt.lit.5                                                                                                                                                       8            0
.xt.prop._ZNKSt8functionIFbvEEclEv                                                                                                                             60            0
.xt.prop.5                                                                                                                                                     96            0
.debug_loc                                                                                                                                                 293058            0
Total                                                                                                                                                     2518569


'Finished building target: tzapu'
' '

10:33:21 Build Finished. 0 errors, 0 warnings. (took 889ms)

==============================================================

On connecting to WiFi on Android Pie mobile device -

*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: No saved credentials
*WM: Connection result: 
*WM: 0
*WM: 
*WM: Configuring access point... 
*WM: AutoConnectAP
*WM: AP IP address: 
*WM: 192.168.4.1
*WM: HTTP server started
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Handle root
*WM: Handle root

No pop-up appears, so I open Google Chrome

*WM: Handle root
*WM: Handle root
*WM: Handle root

Then I open https://www.debian.org and also https://www.debian.org/
Nothing in the serial output in both cases and Google Chrome shows ERR_CONNECTION_REFUSED

Then I open 192.168.4.1
*WM: Handle root
and it takes me to the captive portal.

When my Android Device is idle, this randomly appears multiple times -
*WM: Request redirected to captive portal

Now I open http://www.debian.org and also http://www.debian.org/

*WM: Handle root
*WM: Request redirected to captive portal

and it successfully redirects me to the captive portal in both the cases.

==============================================================

I turn off and turn on my NodeMCU and on connecting to WiFi on Windows 10 laptop -

*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: No saved credentials
*WM: Connection result: 
*WM: 0
*WM: 
*WM: Configuring access point... 
*WM: AutoConnectAP
*WM: AP IP address: 
*WM: 192.168.4.1
*WM: HTTP server started
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal

My default browser opens automatically and -

*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal

it redirects to the captive portal.

On opening HTTPS and HTTP links, it is the same story as with the Android Pie device.

@mariano22
Copy link

mariano22 commented Sep 1, 2021

I found a similar behaviour when using WifiServer library:

When providing HTTP server for captive portal you generally have two options:

  • Using WebServer class and set handlers for roots. The parsing and handling of HTTP header is done by the library.

  • Use WifiServer and receive the HTTP message with header included and handler everything by your own.

If you are doing number 1 and pretend using by connecting with an Android device I suggest adding a handler for the error case showing the captive portal:

server.onNotFound(handleRoot);

I noticed that for Android 10, to properly detect the captive portal and make the phone to show "Touch to log in the network" message is necesary. If not you must navigate to any HTTP address and let the DNS do the job for you (not HTTPS).

@tablatronix
Copy link
Collaborator

So is this a problem with these dns failing and refusing to redirect? Ill look again but I am still confused how we are hitting the 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV Help Wanted Developer Needs Help ESP32 Esp 32 related issue Needs Feeback Developer needs feedback
Projects
None yet
Development

No branches or pull requests

10 participants