tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Context Path for a subdirectory
Date Tue, 04 Dec 2012 17:25:11 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 12/3/12 6:50 PM, André Warnier wrote:
> P.S. If you decide to use UrlRewriteFilter, you should be looking
> at the documentation 
> (http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html),

Cool,
> 
there's a 4.0 version. And it supports mod_rewrite syntax? Very
cool.

> and at a rule using this in the <from> part :
> 
> remote-addr : The IP address of the host making the request, e.g.
> 123.123.123.12 i.e. request.getRemoteAddr() (you probably want to
> negate this, and check for "not (127.0.0.1 or ::1)")
> 
> and probably this in the <to> part : forward (default) :
> 
> Requests matching the "conditions" for this "rule", and the URL in 
> the "from" element will be internally forwarded to the URL
> specified in the "to" element. Note: In this case the "to" URL must
> be in the same context as UrlRewriteFilter. This is the same as
> doing: RequestDispatcher rq = request.getRequestDispatcher([to
> value]); rq.forward(request, response); (to forward the miscreants
> to a no-no page of your choice.)


If you haven't used url-rewrite before, it may seem a bit daunting.
Here's an example to get you started:

<rule>
  <condition type="remote-addr" operator="notequal">127.0.0.1</condition>
  <set type="status">403</set>
  <to last="true">/forbidden.html</to>
</rule>

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC+MfcACgkQ9CaO5/Lv0PAMpQCcDD7oMUAzuTe1xKeuMpm665SR
FjIAn0jE67iGpGMDH9HqjqXFBoa4JFdp
=FdT5
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message