IP Whitelisting

IP Whitelisting allows specific IP addresses to bypass maintenance mode.

Configurations

// config/curtain.php
'allowed_ips' => [
    '127.0.0.1',          // Local development
    '192.168.1.100',      // Office IP
    '10.0.0.1',           // VPN IP
],

Implementation

// CurtainService.php
public function isAllowedIp(?string $ip): bool
{
    $allowedIps = config('curtain.allowed_ips', []);

    if (empty($allowedIps)) {
        return false;
    }

    return in_array($ip, $allowedIps);
}

Best Practices

  • Keep IP list in environment variables

  • Use CIDR notation for IP ranges

  • Document whitelisted IPs

  • Regular audit of allowed IPs

Last updated