Bug #1701
closedmod_redirect rules do not work in 1.4.19
Description
mod_redirect "!~" expression no longer works in version 1.4.19 our lighttpd.conf has not changed - recompiled 1.4.18 to test and it worked switched back to 1.4.19 and it stops working. This rule is to redirect a user back to http from https if they are not in admin or user url.
Eg
$HTTP["url"] !~ "^/(admin|user)" { url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" ) }
We are desperate to upgrade as we have some issues with existing 1.4.18.
-- chris.bragg
Files
Updated by stbuehler over 16 years ago
Did you try this config block in a minimal config or in a big one?
Perhaps you have an url.redirect in a following block which overrides the first one.
Updated by hoffie over 16 years ago
Without having done any investigation myself, I'd still say that -- if this is the case -- it is a regression which needs to be addressed. Nevertheless, you can workaround the problem until a final fix is available. Just drop the conditional and get the not-admin-and-not-user part in the url.redirect key (watch out for "negative lookahead"). :)
Updated by Anonymous over 16 years ago
This is the full nested regex for our drupal installation - like I say this configuration works absolutely fine in 1.4.18 - I am not sure what you mean by large config or small config - our config is fairly large and is for multiple installations we use an include directive for each site.
ie
#include all the ssl virtualhosts $SERVER["socket"] == "172.17.213.254:443" { include "./conf/includes-ssl.conf" }
$HTTP["querystring"] !~ "^q=img_assist/" { $HTTP["url"] !~ "^/img_assist/" { $HTTP["url"] !~ "^/(admin|user)" { $HTTP["url"] !~ ".js|.css|.gif|.jpg|.png|.ico" { $HTTP["url"] !~ "^/imce/browse" { url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" ) } } } } }
Please can you give me an example of how i would rework this as a fix ? obviously we are allowing for many different rewritten urls and are looking for specific patterns.
Updated by stbuehler over 16 years ago
- Status changed from New to Fixed
- Resolution set to worksforme
I just tried your example with the current svn build and the debian 1.4.19 package, and it works.
So i think it is a problem with your config, and i guess fixing the conditional cache was it.
So perhaps you use a rewrite before the redirect, so that the conditionals don't match after it.
Unless you can give us a complete config which doesn't work i close this as worksforme - i don't count the conditional cache reset as regression, that fix was really needed imho.
Updated by stbuehler about 16 years ago
- Status changed from Fixed to Missing Feedback
Updated by pasty almost 16 years ago
In the doc configuration.txt it states that this expression will work with $HTTP["url"]
"!~ perl style regular expression not match" -- does not work
But it does not work in version 1.4.20 and 1.4.19 - I basicly want anything that is not /user redirected back to a none https url.
So
$HTTP["url"] !~"^/user" { url.redirect = ( "^/(.*)" => "http://www.domainname.co.uk/$1" ) }
should work - but it will only work in version 1.4.18 - have compiled and built all 3 in exactly the same way - could it be a fix that has stopped this from working ? If so - does anyone have any suggestions how I can do the same thing?
Full config below
$HTTP["host"] =~ "www.domainname.co.uk" { setenv.add-environment = ("HTTPS" => "on") server.error-handler-404 = "/index.php" auth.debug = 0 auth.backend = "htpasswd" auth.backend.htpasswd.userfile = "/etc/lighttpd/domainnamepassword.conf" $HTTP["url"] =~ "/restricted/" { auth.require += ( "" => ( "method" => "basic" ,"realm" => "Password protected area" ,"require" => "user=domainname" ) ) } url.access-deny = (".~",".inc") $HTTP["url"] =~ "^/files/domainname/private/" { url.access-deny = ("") } $HTTP["url"] !~ "/ssl/" { $HTTP["url"] !~ "^/(user|admin)" { $HTTP["url"] !~ "^/imce" { $HTTP["url"] !~ "/tinymce/" { $HTTP["url"] !~ "\.js$|\.css$|\.gif$|\.jpg$|\.png$|\.ico$" { url.redirect = ( "^/(.*)" => "http://www.domainname.co.uk/$1" ) } } } } } }
Any help greatly appreciated.
Regards to all.
Also available in: Atom