title: AJP Proxy settigs with mod_rewrite
body: <p>I have a problem with AJP proxy settings.</p>
  
  <p><strong>Versions of SW</strong><br>
  Oracle Linux Server 6.5, Apache 2.2.15, Apache Tomcat 7.0.29, tomcat-connectors-1.2.37-src. </p>
  
  <p><strong>Expected behaviour</strong><br>
  <code><em>With slash at the end of URL</em><br>
  http:/@/name.company.local/application/ --> http:/@/name.company.local:8080/application/ <br><strong>It works => OK</strong><br>
  <br><em>Without slash at the end of URL</em><br>http:/@/name.company.local/application -> http:/@/name.company.local:8080/application <br><strong>It does NOT work => K.O.</strong><br>
  <br><em>With path after app name</em><br>http:/@/name.company.local/some/path -> http:/@/name.company.local:8080/application/some/path <br><strong>It does NOT work => K.O.</strong>
  </code></p>
  
  <p><strong>Apache Log file</strong> (var/log/httpd/name.company.local-error_log)</p>
  
  <pre>
  [Fri Dec 13 10:48:33 2013] [error] [client 10.0.100.26] File does not exist: /var/www/name.company.local/application
  [Fri Dec 13 10:48:33 2013] [error] [client 10.0.100.26] File does not exist: /var/www/name.company.local/application
  </pre>
  
  <p><strong>AJP proxy settings</strong> (/etc/httpd/conf.d/ajp.conf)</p>
  
  <p><code>ProxyRequests Off<br> 
  &lt;Proxy *&gt;<br>
  &nbsp;&nbsp;Order deny,allow<br> 
  &nbsp;&nbsp;Deny from all<br> 
  &nbsp;&nbsp;Allow from localhost<br> 
  &lt;/Proxy&gt;<br>
  ProxyPass /application ajp://localhost:8009/application<br>
  ProxyPassReverse /application ajp://localhost:8009/application
  </code></p>
  
  <p><strong>Apache settings</strong> (/etc/httpd/conf/httpd)</p>
  
  <p><code>
      NameVirtualHost *:80<br>
      NameVirtualHost *:443<br> 
      ServerName name.company.local<br><br> 
      &lt;VirtualHost *:80&gt;<br> 
  &nbsp;&nbsp;    ServerAdmin webmaster@company.cz<br> 
  &nbsp;&nbsp;    DocumentRoot /var/www/name.company.local<br> 
  &nbsp;&nbsp;    ServerName name.company.local<br> 
  &nbsp;&nbsp;    ServerAlias application<br><br>
  &nbsp;&nbsp;    RewriteEngine On<br> 
  &nbsp;&nbsp;    RewriteLog "/var/log/httpd/rewrite.log"<br>
  &nbsp;&nbsp;    RewriteLogLevel 9<br> 
  &nbsp;&nbsp;    RewriteCond %{HTTP_HOST} !.local$<br> 
  &nbsp;&nbsp;    RewriteRule ^/(.*)$ http:/@/name.company.local/$1 [R=301]<br>
  &nbsp;&nbsp;    RewriteCond %{REQUEST_URI} !^/application/<br>
  &nbsp;&nbsp;    RewriteRule ^/(.*)$ /application/$1<br>
  &nbsp;&nbsp;    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{User-Agent}i\"" appspecial<br>
  &nbsp;&nbsp;    ErrorLog logs/name.company.local-error_log<br>
  &nbsp;&nbsp;    CustomLog logs/name.company.local-access_log appspecial<br>&lt;/VirtualHost&gt;
  </code></p>
  
  <p>Can you tell me, what is wrong? Or how can I debug it?</p>
  
  <p>With regards</p>
  
  <p>Nautil</p>
  
  <p>P.S. <strong>Due to low reputation at Stack Overflow (I'm a newbie) I could not use more than 2 links, therefore I had to replace valid HTTP protocol prefix with http:/@/.</strong></p>