Question: AppEngine allows the definition of blacklists, to disallow access from certain IP Ranges (http://code.google.com/appengine/docs/python/config/dos.html).

What I would like to do is the inverse: A whitelist, that only allows access from certain IP Ranges.

I am not much of a network specialist, so I would appreciate some help:
If I wanted to limit access to IPs in the Range from 130.100.120.0 to 130.100.123.255, could that be done using AppEngines blacklist mechanism, or should I do the checking from within my application?

Thanks.

Answer: 
No, the AppEngine blacklist functionality (which is documented [here](http://code.google.com/intl/en/appengine/docs/python/config/dos.html) serves more to prevent denial of service attacks and so on. So, the file containing blacklisted IPs can, at most, contain 100 IPs. Thus, the blacklist isn't really intended for industrial strength access control.

Given this, it seems your only option is to do the checking within your application.
Create a Servlet Filter. Something like this:

```
public void doFilter(ServletRequest req, ServletResponse res,
                     FilterChain chain) throws IOException, ServletException {

    // replace with your custom IP checking
    if (!req.getRemoteAddr().equals("127.0.0.1")) {
        HttpServletResponse response = (HttpServletResponse) servletResponse;

        // send any response 
        response.sendError(404);
    }

    filterChain.doFilter(req, res);
}

```