tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Theo.Swe...@avios.com
Subject Tomcat 8 Rewrite Valve
Date Tue, 13 Oct 2015 14:10:00 GMT
Hello - I'm having issues implementing a HTTP 301 redirect via the Rewrite 
Valve module.

Ref - https://tomcat.apache.org/tomcat-8.0-doc/rewrite.html

Tomcat v8.021 is running on Ubuntu 14.04 x64.

The requirement is to run the rewrite config globally for all webapps, for 
this reason the valve is set inside the host.

conf/server.xml

<Host name="localhost" 
appBase="webapps"
unpackWARs="true" 
autoDeploy="false" 
deployOnStartup="true">
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve"

<Manager className="org.apache.catalina.session.PersistentManager" 
saveOnRestart="false">
<Store className="org.apache.catalina.session.FileStore" />
</Manager>

<Valve className="ch.qos.logback.access.tomcat.LogbackValve" quiet="true"
filename="${catalina.base}/conf/logback-access-localhost.xml" />
</Host>

Redirect set inside - conf/Catalina/localhost/rewrite.config

RewriteCond     %{REQUEST_URI}          ^/abc/key$
RewriteRule     ^/abc/key(.*)           /audit-management-ds-1.0/info 
[R=301,L]

Test - curl -vv -X GET http://ubt-srv-14-01:10080/abc/key

* Hostname was NOT found in DNS cache
*   Trying 127.0.1.1...
* Connected to ubt-srv-14-01 (127.0.1.1) port 10080 (#0)
> GET /abc/key HTTP/1.1
> User-Agent: curl/7.35.0
> Host: ubt-srv-14-01:10080
> Accept: */*
> 
< HTTP/1.1 404 Not Found
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Content-Length: 0
< Date: Tue, 13 Oct 2015 13:52:20 GMT

Debug has been enabled on logging yet nothing is showing in the redirect 
in the access log.

However - logs do appear for curl -X GET 
http://ubt-srv-14-01:10080/audit-management-ds-1.0/info 

Any ideas?

Regards,

Theo

-----------------------------------------------------------------------------------------------------------------------------------------
The Mileage Company Limited is a limited company registered in England under company number
2260073 whose registered office address is at
Astral Towers, Betts Way, London Road, Crawley, West Sussex, RH10 9XY.

This email and any files transmitted with it are confidential and intended solely for the
use of the individual or entity to whom they
are addressed. If you have received this email in error please notify the system manager.

This footnote also confirms that this email message has been swept by Mimecast for the presence
of computer viruses. 
-----------------------------------------------------------------------------------------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message