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

Mailing List Archive: Cherokee: users

handler not matching extension in virtual web directory

 

 

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


thebigslide at gmail

Feb 5, 2010, 9:32 AM

Post #1 of 2 (233 views)
Permalink
handler not matching extension in virtual web directory

Hi.

I'm trying to get a handler to match only PHP files in a web-directory. The
directory doesn't exist on the filesystem, and an alternate doc root is
specified in the config.

I'm having issues using AND extension matching in combination with a web
directory rule.

As a test, I tested the following configuration. I configured this in the
admin interface, but here's the relevent snippet.

vserver!70!rule!500!match = and
vserver!70!rule!500!match!left = directory
vserver!70!rule!500!match!left!directory = /admin
vserver!70!rule!500!match!left!final = 1
vserver!70!rule!500!match!right = not
vserver!70!rule!500!match!right!right = extensions
vserver!70!rule!500!match!right!right!extensions = png

I would expect this to match all requests like ^/admin.* that don't have
filetype of png.

I would expect that '/admin/index.php' would be matched by this rule. It is
not.

If I take out the extensions != png clause this works, but all my images are
served through the PHP interpreter.

I tried using a regex to match as well and that also fails to match.

Thanks,

Ryan


alvaro at octality

Feb 8, 2010, 3:58 AM

Post #2 of 2 (211 views)
Permalink
Re: handler not matching extension in virtual web directory [In reply to]

On 05/02/2010, at 18:32, Ryan McIntosh wrote:

> I'm trying to get a handler to match only PHP files in a web-directory. The directory doesn't exist on the filesystem, and an alternate doc root is specified in the config.
>
> I'm having issues using AND extension matching in combination with a web directory rule.
>
> As a test, I tested the following configuration. I configured this in the admin interface, but here's the relevent snippet.
>
> vserver!70!rule!500!match = and
> vserver!70!rule!500!match!left = directory
> vserver!70!rule!500!match!left!directory = /admin
> vserver!70!rule!500!match!left!final = 1
> vserver!70!rule!500!match!right = not
> vserver!70!rule!500!match!right!right = extensions
> vserver!70!rule!500!match!right!right!extensions = png
>
> I would expect this to match all requests like ^/admin.* that don't have filetype of png.
> I would expect that '/admin/index.php' would be matched by this rule. It is not.

Well, I've just made a test, and everything seems to be working fine. This is the configuration:

vserver!10!rule!200!match = and
vserver!10!rule!200!match!left = directory
vserver!10!rule!200!match!left!directory = /admin
vserver!10!rule!200!match!right = not
vserver!10!rule!200!match!right!right = extensions
vserver!10!rule!200!match!right!right!extensions = png
vserver!10!rule!200!handler = custom_error
vserver!10!rule!200!handler!error = 413

vserver!10!rule!100!match = default
vserver!10!rule!100!handler = custom_error
vserver!10!rule!100!handler!error = 410

And this is quick check:

$ cget http://localhost:1234/admin/something.foo 2>&1 | grep Response
Response : 413 Request Entity too large
$ cget http://localhost:1234/admin/something.png 2>&1 | grep Response
Response : 410 Gone

Remember that the behavior rules are evaluated from top to bottom. If the rule does not match the evaluations goes on until another rule is matched or the default rule is matched.

If I understood it right, you'd need a configuration file this:

- Directory /admin: Sets Document Root, NON-FINAL
- Directory /admin and (! Extension png): Handler=FastCGI, FINAL
- Directory /admin: Handler=Static Content, FINAL

or even better:

- Directory /admin: Sets Document Root, NON-FINAL
- Extension PHP: Handler=FastCGI, FINAL
- Directory /admin: Static Content, FINAL

--
Octality
http://www.octality.com/

_______________________________________________
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.