Project

General

Profile

[Solved] Trying subnet whitelist but I got ERROR: ip addr is invalid:

Added by Koi8 about 1 month ago

Hi I'm trying to only allow my IP range (subnet) to access entire website
This is setting I use :-

$HTTP["url"] =~ "^/" {
    $HTTP["remoteip"] == "81.252.0.0/14" {
    }
    else $HTTP["remoteip"] == "81.254.61.141" {
    }
    else $HTTP["remoteip"] != "" {  # (dummy match everything)
        url.access-deny = ( "" )
    }
}

Replies (2)

RE: Trying subnet whitelist but I got ERROR: ip addr is invalid: - Added by gstrauss about 1 month ago

A bit of redundancy in your attempt. Try this:

    $HTTP["remoteip"] == "81.252.0.0/14" {
    }
    else $HTTP["remoteip"] == "81.254.61.141" {
    }
    else {
        url.access-deny = ( "" )
    }

or the equivalent with the logic reversed
    url.access-deny = ( "" )  # default: deny
    $HTTP["remoteip"] == "81.252.0.0/14" {
        url.access-deny = ()  # clear the deny list
    }
    else $HTTP["remoteip"] == "81.254.61.141" {
        url.access-deny = ()  # clear the deny list
    }

RE: Trying subnet whitelist but I got ERROR: ip addr is invalid: - Added by gstrauss about 1 month ago

$HTTP["remoteip"] != "" is invalid as an address.

    (1-2/2)