Lighttpd proxy for multiple Tonido instances.

Support for Tonido on the Desktop including Windows/Mac/Linux
Unhelpful
Regular Tonidoid
Regular Tonidoid
Posts: 17
Joined: Fri Mar 19, 2010 8:24 pm

Lighttpd proxy for multiple Tonido instances.

Postby Unhelpful » Fri Mar 19, 2010 9:00 pm

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: Select all

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

Return to “Tonido Software”

Who is online

Users browsing this forum: No registered users and 8 guests