root/trunk/fon/fonstate/files/etc/fonstated/Redirect

Revision 1168, 0.5 kB (checked in by blogic, 13 months ago)

use https for wan http, put redirector on 8060 as it is now also running if wan is up

Line 
1#!/usr/bin/lua
2
3-- (c) john@phrozen.org gplv2
4
5local uci = require("luci.model.uci").cursor()
6local state = require("luci.fon").state
7
8local lanip = uci:get("fon", "lan", "ipaddr") or "192.168.10.1"
9local lanmask = uci:get("fon", "lan", "netmask") or "255.255.255.0"
10
11local redirrule = "-s "..lanip.."/"..lanmask.." -d ! "..lanip.."/"..lanmask.." -p tcp --dport 80 -j REDIRECT --to-ports 8060"
12
13os.execute("iptables -t nat -D PREROUTING "..redirrule)
14if state.online() == false then
15        os.execute("iptables -t nat -I PREROUTING 1 "..redirrule)
16end
Note: See TracBrowser for help on using the browser.