Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep connected for a local service? #6

Open
thetechknight opened this issue Apr 22, 2020 · 8 comments
Open

Keep connected for a local service? #6

thetechknight opened this issue Apr 22, 2020 · 8 comments

Comments

@thetechknight
Copy link

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?

@23ewrdtf
Copy link
Owner

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?

@thetechknight
Copy link
Author

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.

@thetechknight
Copy link
Author

Oh, I also lose DNS for the entire system, so after the portal installed, I cant use apt-get anymore.

@23ewrdtf
Copy link
Owner

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.

@thetechknight
Copy link
Author

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

@23ewrdtf
Copy link
Owner

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.

@hill-spatiam
Copy link

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

@23ewrdtf
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants