https://hackaday.com/2019/06/10/captiva ... mera-hack/
I see this for Arduino (the captive portal implementation looks easy to use), but cannot find anything for esp-idf.
Captive portal for esp-idf instead of Arduino
Re: Captive portal for esp-idf instead of Arduino
Recently i found this one and with very few changes it works:
https://github.com/cornelis-61/esp32_Captdns
https://github.com/cornelis-61/esp32_Captdns
Re: Captive portal for esp-idf instead of Arduino
It does work well thanks, just by including the .h, adding the .c file, calling captdnsInit() and then making sure the http server processes any http GET request.
In the index.html to which I redirect, I added:
if (!document.location.hostname.startsWith("192")){
window.location = "http://192.168.4.1";
}
because then when the IP address of the ESP32 as STA or AP is used in a browser it does not redirect. There may be better ways to do the redirect so our true IP address shows in the address bar instead of the url from which the DNS server received to supply our index.html
It would be interesting to work out how to then disable the DNS server once the redirect has occurred so that the Android device recognises that there is no internet connection and fails over to the cellular and also prevent the ESP32 from having to deal with a flurry of headers that are too long.
In the index.html to which I redirect, I added:
if (!document.location.hostname.startsWith("192")){
window.location = "http://192.168.4.1";
}
because then when the IP address of the ESP32 as STA or AP is used in a browser it does not redirect. There may be better ways to do the redirect so our true IP address shows in the address bar instead of the url from which the DNS server received to supply our index.html
It would be interesting to work out how to then disable the DNS server once the redirect has occurred so that the Android device recognises that there is no internet connection and fails over to the cellular and also prevent the ESP32 from having to deal with a flurry of headers that are too long.
Re: Captive portal for esp-idf instead of Arduino
Can any please share your code it's very helpful for everyone.
or In this example https://github.com/cornelis-61/esp32_Captdns
How can we start http server instead of that socket connection
or In this example https://github.com/cornelis-61/esp32_Captdns
How can we start http server instead of that socket connection
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot], owenthewizard and 155 guests