This host filter ver. 1.2

This is a Java servlet filter (as per Servlet API 2.3). This filter proceeds (enables) requests from the directly provided hosts (detected by IP addresses) only. Additionally filter proceeds (enables) requests from the localhost. Any another request will be terminated with 403 HTTP status code.

How to use it:

a) download thishostflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. There is one optional initial parameter host. This parameter describes a comma separated list of IP's for allowed hosts. By default (without this parameter) filter enables requests from the localhost ( only.


c) describe a mapping for this filter in web.xml. E.g.:


Also you may exclude some of your files from the processing. Parameter exclude contains regular expresion to match excluded urls. By default is empty (include all).

The typical use cases for this filter are:

- direct access restriction
- prevent bandwidth theft or "hotlinking" as a direct linking to your web site's files (images, video, etc.). An example would be using an <img> tag to display a JPEG image from your site on someone else's web page etc.

   For downloading:

    ThisHost package:  thishostflt.jar

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.


Also in Coldtags: