Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: users

Redirection Handler rule ordering

 

 

Cherokee users RSS feed   Index | Next | Previous | View Threaded


john.m.alberts at gmail

Nov 17, 2009, 6:23 AM

Post #1 of 4 (353 views)
Permalink
Redirection Handler rule ordering

Hi everyone. This is my first post to this list and I'm a new Cherokee user.
I don't know if I've come across a bug or just my ignorance in how to
configure the list of rules when using the redirection handler.
As I add redirection rules using the cherokee-admin web interface, the
rules see to be added in a specific order that can't be changed.
Sometime a rule that I add is put in the middle of the existing rules.
The problem is that the rules appear to match from top down. This
makes it impossible to have a list of rules that specify redirections
that go from very specific url's at the top and have a generic
redirect at the bottom. I don't see any way of changing the order of
rules in the gui.
So, what I did was create the rules using the gui, and then I manually
edited the /etc/cherokee.conf file and re-ordered the rules how I
wanted them. The redirection handlers then worked as I expected them
to. If I then again try to use the gui to add more rules, it will
move the rules back to how it wants to order them and I'll have to
manually change things again.
Am I just not doing something right?

The rules I'm adding are for dokuwiki. Below is what I have in the
order I want them in the /etc/cherokee.conf file. These rules work
fine as shown below. If I decide to now go into the web gui and add
another rewrite rule, it will reorder what I have below.

vserver!10!rule!600!handler = redir
vserver!10!rule!600!handler!rewrite!1!regex = ^/$
vserver!10!rule!600!handler!rewrite!1!show = 0
vserver!10!rule!600!handler!rewrite!1!substring = /wiki/doku.php
vserver!10!rule!600!handler!rewrite!2!regex = ^/_media/(.*)
vserver!10!rule!600!handler!rewrite!2!show = 0
vserver!10!rule!600!handler!rewrite!2!substring =
/wiki/lib/exe/fetch.php?media=$1
vserver!10!rule!600!handler!rewrite!3!regex = ^/_detail/(.*)
vserver!10!rule!600!handler!rewrite!3!show = 0
vserver!10!rule!600!handler!rewrite!3!substring =
/wiki/lib/exe/detail.php?media=$1
vserver!10!rule!600!handler!rewrite!4!regex = ^/_export/([^/]+)/(.*)
vserver!10!rule!600!handler!rewrite!4!show = 0
vserver!10!rule!600!handler!rewrite!4!substring =
/wiki/doku.php?do=export_$1&id=$2
vserver!10!rule!600!handler!rewrite!5!regex = ^/start\?do=login(.*)
vserver!10!rule!600!handler!rewrite!5!show = 0
vserver!10!rule!600!handler!rewrite!5!substring = /wiki/doku.php?do=login$1
vserver!10!rule!600!handler!rewrite!6!regex = ^/start\?do=logout(.*)
vserver!10!rule!600!handler!rewrite!6!show = 0
vserver!10!rule!600!handler!rewrite!6!substring = /wiki/doku.php?do=logout$1
vserver!10!rule!600!handler!rewrite!7!regex = ^/index.php$
vserver!10!rule!600!handler!rewrite!7!show = 0
vserver!10!rule!600!handler!rewrite!7!substring = /wiki/doku.php
vserver!10!rule!600!handler!rewrite!8!regex = ^/\?do=search(.*)
vserver!10!rule!600!handler!rewrite!8!show = 0
vserver!10!rule!600!handler!rewrite!8!substring = /wiki/doku.php?do=search$1
vserver!10!rule!600!handler!rewrite!9!regex = ^/([0-9a-zA-Z]+.*)
vserver!10!rule!600!handler!rewrite!9!show = 0
vserver!10!rule!600!handler!rewrite!9!substring = /wiki/doku.php?id=$1


Thanks for you help.



--
John Alberts
_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


john.m.alberts at gmail

Nov 17, 2009, 6:27 AM

Post #2 of 4 (337 views)
Permalink
Re: Redirection Handler rule ordering [In reply to]

On Tue, Nov 17, 2009 at 8:23 AM, John Alberts <john.m.alberts [at] gmail> wrote:
> Hi everyone.  This is my first post to this list and I'm a new Cherokee user.
> I don't know if I've come across a bug or just my ignorance in how to
> configure the list of rules when using the redirection handler.
> As I add redirection rules using the cherokee-admin web interface, the
> rules see to be added in a specific order that can't be changed.
> Sometime a rule that I add is put in the middle of the existing rules.
>  The problem is that the rules appear to match from top down.  This
> makes it impossible to have a list of rules that specify redirections
> that go from very specific url's at the top and have a generic
> redirect at the bottom.  I don't see any way of changing the order of
> rules in the gui.
> So, what I did was create the rules using the gui, and then I manually
> edited the /etc/cherokee.conf file and re-ordered the rules how I
> wanted them.  The redirection handlers then worked as I expected them
> to.  If I then again try to use the gui to add more rules, it will
> move the rules back to how it wants to order them and I'll have to
> manually change things again.
> Am I just not doing something right?
>
> The rules I'm adding are for dokuwiki.  Below is what I have in the
> order I want them in the /etc/cherokee.conf file.  These rules work
> fine as shown below.  If I decide to now go into the web gui and add
> another rewrite rule, it will reorder what I have below.
>
>    vserver!10!rule!600!handler = redir
>    vserver!10!rule!600!handler!rewrite!1!regex = ^/$
>    vserver!10!rule!600!handler!rewrite!1!show = 0
>    vserver!10!rule!600!handler!rewrite!1!substring = /wiki/doku.php
>    vserver!10!rule!600!handler!rewrite!2!regex = ^/_media/(.*)
>    vserver!10!rule!600!handler!rewrite!2!show = 0
>    vserver!10!rule!600!handler!rewrite!2!substring =
> /wiki/lib/exe/fetch.php?media=$1
>    vserver!10!rule!600!handler!rewrite!3!regex = ^/_detail/(.*)
>    vserver!10!rule!600!handler!rewrite!3!show = 0
>    vserver!10!rule!600!handler!rewrite!3!substring =
> /wiki/lib/exe/detail.php?media=$1
>    vserver!10!rule!600!handler!rewrite!4!regex = ^/_export/([^/]+)/(.*)
>    vserver!10!rule!600!handler!rewrite!4!show = 0
>    vserver!10!rule!600!handler!rewrite!4!substring =
> /wiki/doku.php?do=export_$1&id=$2
>    vserver!10!rule!600!handler!rewrite!5!regex = ^/start\?do=login(.*)
>    vserver!10!rule!600!handler!rewrite!5!show = 0
>    vserver!10!rule!600!handler!rewrite!5!substring = /wiki/doku.php?do=login$1
>    vserver!10!rule!600!handler!rewrite!6!regex = ^/start\?do=logout(.*)
>    vserver!10!rule!600!handler!rewrite!6!show = 0
>    vserver!10!rule!600!handler!rewrite!6!substring = /wiki/doku.php?do=logout$1
>    vserver!10!rule!600!handler!rewrite!7!regex = ^/index.php$
>    vserver!10!rule!600!handler!rewrite!7!show = 0
>    vserver!10!rule!600!handler!rewrite!7!substring = /wiki/doku.php
>    vserver!10!rule!600!handler!rewrite!8!regex = ^/\?do=search(.*)
>    vserver!10!rule!600!handler!rewrite!8!show = 0
>    vserver!10!rule!600!handler!rewrite!8!substring = /wiki/doku.php?do=search$1
>    vserver!10!rule!600!handler!rewrite!9!regex = ^/([0-9a-zA-Z]+.*)
>    vserver!10!rule!600!handler!rewrite!9!show = 0
>    vserver!10!rule!600!handler!rewrite!9!substring = /wiki/doku.php?id=$1
>
>
> Thanks for you help.
>
>
>
> --
> John Alberts
>



--
John Alberts


Sorry, I forgot to mention that I am using version 0.99.17 on CentOS
5.3. I know a new version just came out, but I haven't had a chance
to install it yet. I also don't see anything in the changelog that
addresses the problem I mentioned.

John
_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


stefan at konink

Nov 17, 2009, 10:01 AM

Post #3 of 4 (334 views)
Permalink
Re: Redirection Handler rule ordering [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

John Alberts schreef:
> Am I just not doing something right?

The way you envision it is not the way how Cherokee works.

The rule priority is for each request, not a fall through mechanism that
can rewrite request through request in a specific order.


You can move the rule priority by hitting the double arrow and draging
the rule around.


Stefan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREKAAYFAksC5OIACgkQYH1+F2Rqwn28DwCeOqdNba8CbrGJwO7Wmc2jAU81
dfMAoJMDSaG0K2CaVLNZVaHCQrztSyDw
=vShg
-----END PGP SIGNATURE-----
_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


john.m.alberts at gmail

Nov 17, 2009, 11:40 AM

Post #4 of 4 (329 views)
Permalink
Re: Redirection Handler rule ordering [In reply to]

On Tue, Nov 17, 2009 at 12:01 PM, Stefan de Konink <stefan [at] konink> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> John Alberts schreef:
>> Am I just not doing something right?
>
> The way you envision it is not the way how Cherokee works.
>
> The rule priority is for each request, not a fall through mechanism that
> can rewrite request through request in a specific order.
>
>
> You can move the rule priority by hitting the double arrow and draging
> the rule around.
>
>
> Stefan
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.13 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEAREKAAYFAksC5OIACgkQYH1+F2Rqwn28DwCeOqdNba8CbrGJwO7Wmc2jAU81
> dfMAoJMDSaG0K2CaVLNZVaHCQrztSyDw
> =vShg
> -----END PGP SIGNATURE-----
>


Thanks. I didn't notice the double arrow for dragging the rules around.

John
_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee

Cherokee users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.