0

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 domain.com:8081/path/ which of course times out.

I have tried setting UseCanonicalName On and specifying ServerName to include the port like so: domain.com:80 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
        ServerName domain.com:80

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

        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

</VirtualHost>

What can I do to resolve this incorrect redirect behavior?

1
  • 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? Jul 24, 2012 at 3:12

1 Answer 1

0

Try something like the following:

ServerName domain.com
UseCanonicalName On
UseCanonicalPhysicalPort Off

I think UseCanonicalPhysicalPort Off is the important line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .