Apache Proxy Diagnostic Directives

10 November 2015 by admin

The Apache directives below allows Yavli staff to verify that your Apache server has the required modules enabled, and that it can proxy requests for missing images to Yavli correctly.
Some websites make use of various techniques which requires some customization to the Yavli proxy production directives. The diagnostic directives allows us to figure this out without interfering with your website’s normal operation.

Where to place Diagnostic Directives

If your main Apache config file has granted

AllowOverride All

for your site directory, then you should place these directives first in:

$sitedir/.htaccess

If you can not use .htaccess, then the proxy directives should be placed in your main Apache config. If you are using a VirtualHost directive to configure your site, the directives should go inside of that VirtualHost directive. If you are not using a VirtualHost directive, then the proxy directives should be placed before any other RewriteRule directives you may have, or just at the end of the config file.

Required Modules

The following Apache modules are required:

  1. mod_rewrite
  2. mod_proxy
  3. mod_proxy_http

Diagnostic Directives

# BEGIN YAVLI
<IfModule mod_rewrite.c>
  RewriteEngine on
  Redirect 302 /yavli.mod_rewrite.html /yavli.YES.html
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule "(yavli\.(|jpg|jpeg|png|gif|js|css))$" "/yavli-do-proxy.html" [R]
  <IfModule mod_proxy.c>
    Redirect 302 /yavli.mod_proxy.html /yavli.YES.html
    <IfModule mod_proxy_http.c>
      Redirect 302 /yavli.mod_proxy_http.html /yavli.YES.html
      RewriteRule "yavli.proxytest.html$" "http://steg.yavli.com/test/" [P]
    </IfModule>
  </IfModule>
</IfModule>
Redirect 302 /yavli.mod_rewrite.html /yavli.NO.html
Redirect 302 /yavli.mod_proxy.html /yavli.NO.html
Redirect 302 /yavli.mod_proxy_http.html /yavli.NO.html
# END YAVLI

Note For WordPress Sites

If you are using WordPress, your .htaccess file probably has the following – or a similar – WordPress-specific configuration block:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Our configuration has to be placed above the WordPress block, otherwise Apache will ignore it.