tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rifel <>
Subject Re: Access Log Entries with VHost Rewriting
Date Mon, 07 Jul 2014 19:44:30 GMT
Ah my mistake, after stepping through the rewrite valve code it turns out
the rule wasn't working after all.  The [host] flag for the rule means
you're comparing the host header rather than the url of the request.  For
anyone else setting up virtual-host rewriting, the correct rewrite.config
for this scenario would simply be as follows:

RewriteRule .+cdn\.domain\.com [host]

The requests are now getting sent to the correct virtual host and its
designated access log.

Sorry for the noise,

On 7/7/14, 11:05 AM, "Peter Rifel" <> wrote:

>I'm implementing some virtual-host rewriting in tomcat 8's rewrite valve
>and am wondering if I can somehow set the order that valves are processed
>for a host.  I have a default host and want all requests that have a
>HTTP_HOST of * to be redirected to a second host.  I have
>the host rewriting working but the access log entry appears in the
>default host's log rather than the second host.  Is there a way to either
>have the access log valves get processed after the rewrite valve, or some
>other setting to have the entry appear in the correct log?  I tried
>changing the order of the valves in server.xml but it didn't have any
>For what its worth, the reason I'm not using aliases on the second host
>is because the list is dynamic (we use developers' names in their dev
>environment's subdomains, so I'd like a catch all for their non-default
>hosts rather than maintaining an ever-growing list of aliases.)
> goes to the default host of
> gets rewritten to our second host of
>that accepts * through the default host's rewrite valve.
> now shows up in the access log rather
>than the access log.
>Here is my rewrite.config:
>RewriteCond %{HTTP_HOST} .*cdn\.domain\.com
>RewriteRule /(.*)$1 [host]
>Does anyone know if this is possible?
>Thank you!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message