On Wed, Feb 3, 2010 at 1:30 PM, Rob Kendrick <r...@simtec.co.uk> wrote:
> Hi, > > I'm trying to configure Xavante with two distinct filehandler > handlers. I seem to be having trouble with the semantics of the rules > table, and all I can find in the documentation are examples that only > have the one rule for using filehandler. > > What I have currently is this: > > { > { > match = "^/index$", > with = wsapi.xavante.makeHandler(pages.index.run, "", "", > "") > }, > > { > match = "^/resources", > with = xavante.filehandler, > params = { baseDir = settings.get "web_resources" } > }, > > { > match = ".", > with = xavante.filehandler, > params = { baseDir = root .. "docroot/" } > } > } > > What I am trying to achieve is that certain leafs get redirected to > WSAPIs, anything in the URI path /resources/ gets fetched from a > directory on the local file system, and everything else gets fetched > from a different directory on the local file system. > > However, a quick strace shows that requests for /resources/foo get > looked up in the latter (match = "."), and a 404 returned. Are these > rules not in order of preference of match, decending? Have I confused > the meaning of it? > > Hi Rob, They are tried in order of preference. But remember that Xavante will look at basedir .. "/resources" .. rest_of_uri in your example, are you sure the problem isn't that you do not have a "resources" folder under your web_resources path? If you want to strip the /resources part from the path you can try this rule: { match = "^(/resources)", with = function (req, res, cap) req.relpath = req.relpath:sub(#cap[1]+1) return xavante.filehandler(settings.get "web_resources")(req, res) end }, -- Fabio Mascarenhas
_______________________________________________ Kepler-Project mailing list Kepler-Project@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/