On 01/06/2011 03:36 PM, Charlie Sharpsteen wrote:

And dispatch to virtual servers based on the name of the first subfolder. I.E. a match like

alt.domain.net/blog <http://alt.domain.net/blog> -> host match for blog virtual server alt.domain.net/code <http://alt.domain.net/code> -> host match for code virtual server

I have been trying to do this with wildcards and regexes, but have been unsuccessful so far.

Charlie,

From my recent interactions on this list and experiences gained, I feel I could offer some helpful hints...

Your situation is similar to mine in that you have to instruct Cherokee to separate processing per each directory, but you can also use that which my situation didn't need-- hostname matching.

So (and this could be a test to see if I appropriately understand Cherokee's functionality flow), I'd suggest the following:

    - Create a Virtual Server (I'll call it "alt.domain.net")
- For the "alt.domain.net" virtual server, you can set the Host Match criteria (by ip, hostname, wildcard, whatever) to alt.domain.net (that which it will be called by from clients). - From there, under Behavior, you'll want the following rules (again, for the "alt" virtual server): - make a Directory rule for /blog (/blog is the "Web Directory"), "List and Send" handler... set the Document root here to that which contains the /blog content.
        - repeat (Directory rule), but this time for /code.

These two rules will identify the directory requested and reassign the docroot. If you wish to perform additional processing AFTER this identification has taken place, you'll want these to be "non-final" rules.

In my case, my rule order (from top to bottom, final unless otherwise noted) is as follows:

    - Extensions PHP (non-final)
    - Directory /about
    - Directory /cgi-bin
    - Directory /cherokee_themes
    - Directory /icons
    - Directory /random_stuff
    - Directory /info
    - Directory /downloads
    - Directory /wiki (non-final)
    - Directory /wiki2 (non-final)
    - Directory /lib OR Path /favicon.ico (for dokuwiki processing)
    - Default (contains redirection rules for dokuwiki url rewriting)

Although my situation is not working 100% (my regex don't seem to be matching, so url rewriting is not working), I can successfully query either wiki (and the other directories)... so I know that proper selection is taking place.
Is it possible to have host match key on subdirectories or does host match only look at the part of the URL that exists before the first `/` ?

The result of my explorations and conversations has been "no, not subdirectories"... the host match is applied to virtual servers, which is against name only, and not any content-- so only what comes before the first '/'.

 Hope that helps.

-Matthew
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to