Rewriting $request_filename

W. Andrew Loe III andrew at andrewloe.com
Thu Feb 19 03:42:59 MSK 2009


I have two rails applications running on one domain. I need to modify
the $request_filename under the location /signup so static assets for
my signup app are served by nginx, and not mongrel (which does
currently work). I've tried doing it a few different ways but it
doesn't seem to work.

My full config:

http://gist.github.com/66637

I first tried using a regular expression on the location:

location ~* /signup(.*) {
  set $modified_request_filename $1;
}

That wasn't working as I expected so I tried using an if block:

if ($request_filename ~* ^/signup(.*)) {
  set $modified_request_filename $1;
}

In both cases $modified_request_filename appears to be blank. (only
checked by proxy_passing to
http://airstrip$modified_request_filename). How can I get some
debugging output of this variable's value, and how can I test for the
existence of a file, minus the /signup prefix which will always be
there.





More information about the nginx mailing list