1

I recently got a raspberry pi. I have it set up as an access point in a standalone network (not connected to the internet). I can also serve a static website on this network. Ive been trying to set up a captive portal so that when a user joins the network it automatically takes them to this website.

Looking at these tutorials:

This is how I set up the access point

For captive portal using nodogsplash

So the access point is working but honestly I have no clue about how the captive portal works with this. Im wondering whether the pi has to be connected to the internet for the captive portal to work? If anyone knows anything useful, I will forever be in your debt.

0

In case of you need a customizable captive portal you can install all using this project Kupiki https://github.com/pihomeserver/Kupiki-Hotspot-Script

Once installed you can replace the captive portal by what ever you want using the Nginx configuration.

Internet is not mandatory. It's usefull if you want the page to be closed automatically once you are authenticated as it tries to reach a specific page to confirm that Internet is up

0

Captive portals work because devices make a DNS request to specific URLS, depending on which operating system, and they expect a success response. If they get a redirect instead, then they will show that new site as a captive portal.

A list of some of the URL's can be found here: How Automatic Detection of Captive Portal works.

If you followed that tutorial, then you can change your DNS server to redirect any request to a domain that isn't yours to the Raspberry Pi. The /etc/dnsmasq.conf file controls the DNS server. Add the following line to redirect all requests (change the IP address if you chose not to use 192.168.4.1)

address=/#/192.168.1.1

You will then need to set up your webserver to redirect those requests. I suggest choosing a URL, like http://mysite/, and telling your webserver (such as nginx) to show your site for that domain, and send a redirect for all other domains.

For setting up redirects, see the following pages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.