Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By treii28
#54134 I'm searching the forums trying to figure out the recommended way to do captive portal on ESP8266 and seeing a mixed bag of responses ranging from lua code to modifying cpp files. I tried one example using the arduino dnsServer but it seems to be producing errors/crashes.

What is the recommended way to do a captive portal from a softAP? My device is not going to be internet connected but I would like to make any http requests made while connected to it to go to the server's landing page if they aren't already pointing at the server's ip or local hostname.

SW
User avatar
By treii28
#54148
bbx10node wrote:The following example works without crashing.

https://github.com/esp8266/Arduino/blob ... Portal.ino

See also the CaptivePortalAdvanced example. The examples are also available via the Arduino IDE File -> Examples option.


OK, that was essentially the one I used. I basically added the lines:

Code: Select all#include <DNSServer.h>
DNSServer dnsServer;
const byte DNS_PORT  = 53;

// [...]

dnsServer.start(DNS_PORT, "*", WiFi.LocalIP()); // in setup after the softAP setup


And that's what was crashing. I may have left the mDNS include line in there but I commented out the mDNS setup. Would those two conflict with the other just being included in there?

SW
User avatar
By treii28
#54149 Alright, when I tried it earlier I was remote desktop'ing to home so I thought it was crashing but maybe it's not. If I try any url other than the IP address, it says this site can't be reached. If I do the ip address, I get the favicon next to the domain name, but the same message. Meanwhile, the serial monitor shows the following over and over:

Code: Select alladd 1
aid 1
station: 38:0b:40:29:93:5f join, AID = 1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
....