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 cdn.domain.com [host] The requests are now getting sent to the correct virtual host and its designated access log. Sorry for the noise, Peter On 7/7/14, 11:05 AM, "Peter Rifel" <pri...@mixpo.com> wrote: >Hello, > >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 *cdn.domain.com 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 >effect. > >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.) > >Example: >peter.domain.com goes to the default host of domain.com >peter-cdn.domain.com gets rewritten to our second host of cdn.domain.com >that accepts *cdn.domain.com through the default host's rewrite valve. >peter-cdn.domain.com now shows up in the domain.com access log rather >than the cdn.domain.com access log. > >Here is my rewrite.config: > >RewriteCond %{HTTP_HOST} .*cdn\.domain\.com >RewriteRule /(.*) cdn.domain.com/$1 [host] > >Does anyone know if this is possible? > >Thank you! >Peter --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org