It is currently Sun May 19, 2013 10:16 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Lighttpd proxy for multiple Tonido instances.
PostPosted: Fri Mar 19, 2010 9:00 pm 
Regular Tonidoid
Regular Tonidoid
Joined: Fri Mar 19, 2010 8:24 pm
Posts: 17

I'm using lighttpd to map Tonido to a path among my existing lighttpd-served pages. Why would I do this? There are a few reasons. You might want to run several instances of Tonido on a multiple-user system, with each user having appropriate permissions when browsing files, you might want to use Tonido with existing SSL credentials already served by lighttpd, or you might just want it integrated into your existing site. Here's the recipe I'm using with v1.5 (svn), using mod_proxy_core and mod_proxy_backend_http:
Code:
$HTTP["url"] =~ "^/tonido/<USER>(/?|/.*)$" {
    proxy-core.protocol = "http"
    proxy-core.backends = ( "127.0.0.1:10001" )
    proxy-core.rewrite-request = (
        "_uri" => ( "^/tonido/<USER>/?(.*)" => "/$1" )
    )
    proxy-core.rewrite-response = (
        "Location" => ("^(?<!/tonido/<USER>)/(.*)" => "/tonido/<USER>/$1" )
    )
}

The (/?|/.*) is important so that it will catch /tonido/unhelpful as well as paths under it. The rewrite-response part is important also, since Tonido will respond with a redirect to /ui/core/index.html when you try to access /, and we want that rewritten to be under the /tonido/<USER> directory. If there's only one instance of Tonido, you could leave out the <USER> subdirectory to just serve it as /tonido. For multiple instances you'd write several such rules with a different <USER> for each.

edit: use a look-behind to make it a bit more robust - should catch any redirects that don't have the /tonido/<USER> prefix now.


Offline
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours [ DST ]


 Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: