httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zsolt Jonas <>
Subject [users@httpd] RewriteMap + after a while wrong redirects
Date Sun, 15 Nov 2015 21:18:28 GMT
Hi All,

OS: *Ubuntu 14.04.2 LTS*
Apache: *2.4.7-1ubuntu4.4*

*/etc/apache2/sites-available/000-default.conf* file:

    Mutex file:/var/lock/apache2 rewrite-map
    <VirtualHost *:80>
    RewriteMap phpmap prg:/path/to/rewrite.php
    RewriteBase /
    RewriteRule .*

I know, the PHP is not the best way for the RewriteMap+prg, but 
currently we can't change it. A new CMS is under development, but it 
will take at least 1 year yet, so I need to solve the redirect problems 
with the current configuration.

_Current situation:_

1) We have one Amazon ELB with two instances for the CMS servicing. In 
the databases there are more hundred domains with more thousand 
redirects. (there are inside redirect: domain.tld/before --> 
domain.tld/after and to outside: olddomain.tld --> newdomain.tld as well).

2) The rewrite.php handles the redirects and I full debugged the 
rewrite.php it works correctly it always sends back the right url to the 

3) After a while the inside redirects will be stopped and the outside 
redirects work pell-mell (should be: client1-old-domain.tld --> 
client1-new-domain.tld however the redirect does it: 
client1-old-domain.tld --> client2-new-domain.tld and it's very 

4) as the number of the sites is growing the "after a while" is getting 

I believed the lack of the Mutex caused the problem but I've checked and 
the mutex is on:

    $ sudo apachectl -S | grep -i mutex
    Mutex watchdog-callback: using_defaults
    Mutex rewrite-map: dir="/var/lock/apache2" mechanism=fcntl
    Mutex default: dir="/var/lock/apache2" mechanism=fcntl
    Mutex mpm-accept: using_defaults

Currently I have only one solution: the Apache reload. If I reload the 
apache (sudo service apache2 reload) the all problem go away for a 
while. So currently both of the two Apache webservers are reloaded every 
5 minutes but this is not the desired way :) But I can't find the real 
problem and the solution. I've read the changelog to Apache 2.4.17 but I 
didn't find any relevant fixes.

Does anybody have a guess what can cause the problem? What and how 
should I check?

Thanks for any advice in advance!

Best regards,

View raw message