OpenWrt Forum Archive

Topic: Publiv hotspot with advertisements

The content of this topic has been archived on 25 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I would like to build a public wifi hotspot which interrupts user-surfing after about 15 minutes by showing a commercial. I think I need a transparent proxy to achieve this but dont know which one could do that. Could someone help me with that and give me a hint of the configuration?
Thank you in advance
Mike

You don't need a transparent proxy, only a webserver and a few iptables rules.
Use "PREROUTING" in iptables in order to redirect the HTTP traffic of a source ip-address (one user) to the webserver where you have the advertising.

This is a "Quick and Dirty" solution, which not even is accurate for a single-user hotspot.
For multiple users, you have to track the timer schedule individually, based on IP, for example.
Second, sooner or later, you will "interrupt" the loading of various objects for a page with the REDIRECT.

For a reasonable solution, the beginning is to use "squid", which has a very basic captive portal functionality.
As a commercial solution, best of breed, I developed a special proxy, which modifies html "on-the-fly", so that the ad is generated within the context of the visited page.

The problem with Squid is its high cosumption of hardware resources, what it's made useless in small devices with low hardware specs.

You can control the time of every single user, just use the option "-s" (--source) of iptables. and a simple cgi script in the webserver that it control the time of a single ip addr (using the cgi var REMOTE_ADDR).

A few years ago I developed a HTTP proxy (without use squid, coding it from zero in C) to add html/js code on-the-fly too. The problem nowadays is the high use of HTTPS websites.

(Last edited by KHAN85 on 9 Sep 2015, 11:38)

The discussion might have continued from here.