Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having an issue with the redirect that occurs with mod_dir when a trailing slash is missing. Our setup uses a load balancer listening on port 80 with multiple web servers that listen on non-standard ports like 8081.

When mod_dir issues the redirect it is attempting to redirect to which of course times out.

I have tried setting UseCanonicalName On and specifying ServerName to include the port like so: but it doesn't seem to have any effect.

My virtual host is as follows:

Listen 8081
<VirtualHost *:8081>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/domain_static
        UseCanonicalName Off

        <Directory /var/www/domain_static>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all

        ErrorLog /var/log/apache2/static-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/static-access.log combined


What can I do to resolve this incorrect redirect behavior?

share|improve this question
Your load balancer is where you can account for this behavior - either by manipulating the Host header sent to the port 8081 listener, or rewriting the Location header in the response. What software does it run? – Shane Madden Jul 24 '12 at 3:12

Try something like the following:

UseCanonicalName On
UseCanonicalPhysicalPort Off

I think UseCanonicalPhysicalPort Off is the important line.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.