Project

General

Profile

Actions

Bug #1701

closed

mod_redirect rules do not work in 1.4.19

Added by Anonymous almost 16 years ago. Updated over 15 years ago.

Status:
Missing Feedback
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

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

fullconfig.jpg (47 KB) fullconfig.jpg pasty, 2009-01-08 17:37
Actions #1

Updated by stbuehler almost 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.

Actions #2

Updated by hoffie almost 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"). :)

Actions #3

Updated by Anonymous almost 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.

Actions #4

Updated by stbuehler over 15 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.

Actions #5

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Missing Feedback
Actions #6

Updated by pasty over 15 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.

Actions #7

Updated by pasty over 15 years ago

Actions

Also available in: Atom