Replies: 3 comments 2 replies
-
I have seen something whitch listen to dns port (AP port 53) and redirect to what port you want. |
Beta Was this translation helpful? Give feedback.
-
You can see it in the output because the handle_client() function doesn't fully close the client connection after handling the request. To properly close the connection, you should call the close() method on the writer object after sending the response. |
Beta Was this translation helpful? Give feedback.
-
This approach probably does not fit what you need, but perhaps using MDNS setting network.hostname() might be useful. On the ESP32 (and probably other boards), MDNS works both in AP and STA mode, and avoids having to enter a specific IP in the browser. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I have a micropython project that reads some sensor data and displays it on a html webpage. I connect to the project with it in AP mode. Currently I need to go to the specific URL (192.168.4.1) to view the webpage. I would like to change this so if I enter any URL, it redirects to 192.168.4.1 (index.html). I am happy to assume the device I connect with is setup to use DNS as provided by the AP:
This code looks like it should do the job https://github.com/p-doyle/Micropython-DNSServer-Captive-Portal/tree/master
Any ideas (or other methods of doing this) much appreciated.....
I added these uasyncio tasks:
And the main bit of code:
This is the output I get:
I think 'async def handle_client' never runs......
Beta Was this translation helpful? Give feedback.
All reactions