martin-ger / lwip_nat_arduino

lwip library with NAT feature for Arduino environment
59 stars 20 forks source link

External captive portal #8

Closed akshar001 closed 4 years ago

akshar001 commented 4 years ago

Hello, This is a great thing to do, i thank you completely for effort, Now what if we want to redirect the request to any other internet page? Like external captive portal running in server, How would we do that?

martin-ger commented 4 years ago

Think, it should be enough to change the redirects in l130 ff. and 169ff. However, you will need some additional meachanism to tell the ESP, when a MAC is authenticated and in the list of accepted clients.

akshar001 commented 4 years ago

Can you just let me know how to do that, I mean a way to do it. I will try to do it and as well contribute to your library for other people as well, i didn't understand that l130 ff. and 169ff.

martin-ger commented 4 years ago

Lines 130 - 136 and lines 169 - 173 in CaptiveHotspot.ino are the redirects of any HTTP request to the local address and the rewrite of the replies. This has to be changed to the IP of the other server.

When that server at this IP has handled the request successfully, it has to tell the ESP to add it to the allowed_macs array. Could be done by a separate service on the ESP or perhaps via a central MQTT broker...?

akshar001 commented 4 years ago

Yes they redirect any kind of http request to requested ip address. I understand your concern about how to add allowed_mac address to local esp if we are redirecting to a server, Yes we can use mqtt or local http get request to server, there are many ways, now what i learnt that this code modify the ip address of the requests to our desire ip, but i want to find out how we are going to modify the pages thing like what if we want to redirect to specific page, where we need to kind a change whole http url itself in request not just ip address.

martin-ger commented 4 years ago

Okay, what about the following idea:

akshar001 commented 4 years ago

Yes it would be great, I tried one thing that already, But i was using esp8266 with https and ESP got restarts somewhere