Can I save an Apache environment variable value with SetEnv?
        Posted  
        
            by 
                Nicholas Tolley Cottrell
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Nicholas Tolley Cottrell
        
        
        
        Published on 2012-10-24T08:59:08Z
        Indexed on 
            2012/10/24
            11:03 UTC
        
        
        Read the original article
        Hit count: 375
        
I am running Apache 2.2 with Tomcat 6 and have several layers of URL rewriting going on in both Apache with RewriteRule and in Tomcat. I want to pass through the original REQUEST_URI that Apache sees so that I can log it properly for "page not found" errors etc.
In httpd.conf I have a line:
SetEnv ORIG_URL %{REQUEST_URI}
and in the mod_jk.conf, I have:
JkEnvVar ORIG_URL
Which i thought should make the value available via request.getAttribute("ORIG_URL") in Servlets.
However, all that I see is "%{REQUEST_URI}", so I assume that SetEnv doesn't interpret the %{...} syntax. What is the right way to get the URL the user requested in Tomcat?
© Server Fault or respective owner