Maintenance mode for all but my ip

B.R. reallfqq-nginx at yahoo.fr
Sat Dec 7 14:58:43 UTC 2013


I am new to the use of maps, but I suppose it would fit perfectly, using
core variables such as the binary IP address:
Maybe something like:

server {
    error_page 503 /503.html # Configuring error page

    map $binary_remote_addr $target { # Configuring white-listed IP
addresses
        default                                                    KO
        your_whitelisted_binary_IP_address_value OK
    }

    rewrite ^.*$ $target #Redirecting all traffic according to map-assigned
value

    location @OK { # Named location to do nothing, i.e. serve content as
usual
    }

    location @KO { # Named location to trap maintenance traffic, spawning a
HTTP 503 error
        return 503;
    }
}

Untested, thus unsure, but I'd seek something looking like this.
---
*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131207/e880ea41/attachment.html>


More information about the nginx mailing list