Captive-Portal
Captive-Portal copied to clipboard
Keep connected for a local service?
The captive portal is working great, but the reason I need the captive portal is so the web page will pop up and redirect the user to access a locally hosted service.
Trouble is, when a phone is on the captive portal page, it will only ever load that page. it wont load any other resource or even resolve the DNS thats on the PI.
I dont understand why this is happening.
any ideas?
This captive portal redirect users to index.php that is hosted from nginx weserver. You can replace it with any page with hyperlinks and images and reconfigure nginx if you need to. I use it that way and it works fine. Can you describe what is happening in more details? Did you replace index.php?
Well I am trying to use a webapp framework that I wrote, which runs on port 51042. Requires HTML5, canvases, etc...
the default nginx pops up sure. but if I say go to Chrome and navigate to hotspot.localnet instead from there, it never loads. It tries to use the mobile internet instead.
Oh, I also lose DNS for the entire system, so after the portal installed, I cant use apt-get anymore.
Well, the idea behind this project was to solve a specific issue for my own project and I was fed up with complexity of other captive portals so I wrote this. This captive portal can be used as a template to modify for other projects.
Do you run that webapp from Captive Portal nginx ?
There is an iptables rule to forward traffic to 192.168.24.1:80 so this might cause issues too.
This script needs an update to be honest and android developer to understand the android logic.
Well its not going to work anyways, becuase sadly it appears that Websockets dont work behind a "captive portal" browser page. Since my app requires that, it just throws an error.
but I was able to get it to redirect
Yes that another issue. One way to fix it is to get captive portal to allow traffic after you click some button but I was having troubles figuring that out.
Were you ever able to figure out how to include a button that allows traffic? It would be nice to see some code for having a 'Connect' button that resolves the captive portal needs and connects to the network
Hi, No, I didn't have time to look into that, and I don't think I will in the near future.
Most likely I would have to rewrite the whole thing to use iptables to block/allow traffic. Similar to those: https://andrewwippler.com/2016/03/11/wifi-captive-portal/ or https://wiki.andybev.com/doku.php?id=using_iptables_and_php_to_create_a_captive_portal