Hi

I've been thinking about a potential project for GSoC 2013, an
mk_location core module.

The module goal would be to translate an URL to a file location using
aliases and rewrites and also limit the number of modules used on a
request.

The configuration would be located with the vhost information in a
location section. I would suggest something like this, but the
functionality is more important then the actual syntax.

[Host]
        DocumentRoot /var/www/vhost

[Location /doc]
        Alias /var/www/doc

[Location /images]
        Alias /var/www/images
        Handler static

[Location /users]
        Rewrite ^/users/{.*}$ /show.cgi?user=$1?

[Location /show.cgi]
        Handler cgi

The Handler directive would basically restrict the number of modules
which receive the stage30 call. Alias and rewrite would work as they do
in apache and nginx.

This module would reduce the effort required to produce good plugins for
monkey. Plugins would only almost only care about the file path and
reduce the chance that two plugins try to render the same resource.
With this change, stage_30 could always be trusted to mean that this
request should be rendered. Compatibility will not be a problem as
current plugins already does location matching. To handle location
specific settings would still require plugin changes of course.

Producing this module wouldn't require too much effort if posix regex is
used. The integration with monkey would probably involve some extra
request_session state and refactoring in mk_http/mk_headers. Rewrites
should be applied before Alias and multiple Rewrite or Aliases
directives on the same Location isn't supported by the configuration
format (correct me if I'm wrong). If rewrite changes the location, that
too should be handled.

I would very much like to see this in monkey!

-- 
Sonny Karlsson
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to