tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rifel <pri...@mixpo.com>
Subject Access Log Entries with VHost Rewriting
Date Mon, 07 Jul 2014 18:05:37 GMT
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

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