One way would be to modify the log format to include your variable.<br><br>However, I sometimes use a different method that&#39;s a bit of a hack but has some advantages, the two biggest of which are the ability to see the output on the client and that it&#39;s easier to rip out the config when you&#39;re finished.&nbsp; This second point is especially true if you don&#39;t already use a custom log format.<br>
<br>You can add a cookie to the response to show the value of a variable.<br><br>add_header Cookie &quot;mod_req=$modified_request_filename&quot;;<br><br>And then can test that using &quot;curl -i <a href="http://domain.com">domain.com</a>&quot; (or -I if all you care about are the headers) or with Firefox and one of its cookie/header inspection plugins.<br>
<br>Note that you can add multiple cookies by calling &quot;add_header Cookie&quot; multiple times (with different cookie names, of course), but it appears that nginx only adds the cookie to the response once the request is finished being handled, so only the final value of a variable can be passed as a cookie value.<br>
<br>For example, the following:<br><br>set $my_var &quot;a&quot;;<br>add_header Cookie &quot;var_1=$my_var&quot;;<br>set $my_var &quot;${my_var}b&quot;;<br>add_header Cookie &quot;var_2=$my_var&quot;;<br><br>will return two cookies with the response:<br>
<br>Cookie: var_1=ab<br>Cookie: var_2=ab<br><br>I had expected the first cookie to be &quot;var_1=a&quot; and the second to be &quot;var_2=ab&quot;, but both have a value of &quot;ab&quot;, which is the final value of the $my_var variable.<br>
<br>If you need to output multiple cookies, you can just use multiple variables that don&#39;t change after being set initially.<br><br>Again, it&#39;s a bit of a hack, but as it&#39;s only temporary, I don&#39;t have a problem with it.<br>
<br><br><div class="gmail_quote">On Wed, Feb 18, 2009 at 6:42 PM, W. Andrew Loe III <span dir="ltr">&lt;<a href="mailto:andrew@andrewloe.com">andrew@andrewloe.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have two rails applications running on one domain. I need to modify<br>
the $request_filename under the location /signup so static assets for<br>
my signup app are served by nginx, and not mongrel (which does<br>
currently work). I&#39;ve tried doing it a few different ways but it<br>
doesn&#39;t seem to work.<br>
<br>
My full config:<br>
<br>
<a href="http://gist.github.com/66637" target="_blank">http://gist.github.com/66637</a><br>
<br>
I first tried using a regular expression on the location:<br>
<br>
location ~* /signup(.*) {<br>
 &nbsp;set $modified_request_filename $1;<br>
}<br>
<br>
That wasn&#39;t working as I expected so I tried using an if block:<br>
<br>
if ($request_filename ~* ^/signup(.*)) {<br>
 &nbsp;set $modified_request_filename $1;<br>
}<br>
<br>
In both cases $modified_request_filename appears to be blank. (only<br>
checked by proxy_passing to<br>
<a href="http://airstrip" target="_blank">http://airstrip</a>$modified_request_filename). How can I get some<br>
debugging output of this variable&#39;s value, and how can I test for the<br>
existence of a file, minus the /signup prefix which will always be<br>
there.<br>
<br>
</blockquote></div><br>