Hi All, I am developing my first serious catalyst application and am so far finding the application development pretty straightforward, but I am having a really frustrating deployment problem. I am trying to run my catalyst app using fastcgi through apache, using a static fastcgi server setup. I am not sure if the problem I am having is related to apache, fastcgi, or catalyst itself:
I have the following rules configured for my virtual host in apache: RewriteCond %{REQUEST_URI} !^/foo/bar RewriteRule ^/(.*)$ /foo/bar/$1 [PT] Alias / /Path/To/MyApp/script/myapp_fastcgi.pl/ In other words, I want a request to http://myserver/ to be rewritten as /foo/bar, a request for http://myserver/baz to become /foo/bar/baz, and so forth. I want all requests going through this server to automagically and quietly prepend "foo/bar/" to the request path, giving access to a sub part of the application as a whole. When I try http://myserver/, the rewrite log shows the following (IP, server, and other log fields stripped for clarity): (2) init rewrite engine with requested uri / (3) applying pattern '^/(.*)$' to uri '/' (4) RewriteCond: input='/' pattern='!^/foo/bar' => matched (2) rewrite '/' -> '/foo/bar/' (2) forcing '/foo/bar/' to get passed through to next API URI-to-filename handler (2) init rewrite engine with requested uri /foo/bar/ (3) applying pattern '^/(.*)$' to uri '/foo/bar/' (4) RewriteCond: input='/foo/bar/' pattern='!^/foo/bar' => not-matched (1) pass through /foo/bar/ My catalyst app reports $c->request->path as being "foo/bar/". So far, so good. However, when I try http://myserver/baz, the rewrite log shows what I expect it to: (2) init rewrite engine with requested uri /baz (3) applying pattern '^/(.*)$' to uri '/baz' (4) RewriteCond: input='/baz' pattern='!^/foo/bar' => matched (2) rewrite '/baz' -> '/foo/bar/baz' (2) forcing '/foo/bar/baz' to get passed through to next API URI-to-filename handler (2) init rewrite engine with requested uri /foo/bar/baz (3) applying pattern '^/(.*)$' to uri '/foo/bar/baz' (4) RewriteCond: input='/foo/bar/baz' pattern='!^/foo/bar' => not-matched (1) pass through /foo/bar/baz but my app reports $c->request->path as being "baz" and not "foo/bar/baz" Likewise, a request for http://myserver/a/b/c will result in "a/b/c" in $c->request->path, not "foo/bar/a/b/c". Does anyone know why this is happening? Why Apache seems to be rewriting the request successfully, but only passing along the substituted path when the initial request was for "/", and otherwise passing along the un-rewritten path? thought that that catalyst might be getting the path from the original HTTP request and not any of the rewrites, but then why would "/" be successfully remapped to "/foo/bar"? I have tried various combinations of mod_rewrite and mod_alias, including simply doing something like this: Alias / /Path/To/MyApp/script/myapp_fastcgi.pl/foo/bar/ They all seem to result in the exact same behaviour. If I outright redirect the request (replace [PT] with [R] in the rewrite rule) it of course works, but then "foo/bar" appears in the URI, which is exactly what I am trying to make not happen. -William _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/