<meta http-equiv="content-type" content="text/html; charset=utf-8">&gt; Do you mean &quot;backup&quot; as in &quot;server ... backup;&quot; in upstream definition?<br><br><div>I do. And thank you for the detailed reply -- this was exactly the information I was looking for!</div>
<div><br></div><div>Cheers,</div><div>-steven</div><div><br></div><div><br><div class="gmail_quote">On Wed, May 18, 2011 at 3:00 PM, Maxim Dounin <span dir="ltr">&lt;<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello!<br>
<div class="im"><br>
On Wed, May 18, 2011 at 02:35:49PM -0500, Steven Deobald wrote:<br>
<br>
&gt; Hey folks,<br>
&gt;<br>
&gt; We&#39;ve got the following scenario occurring in production. The solution is<br>
&gt; non-obvious... to me, at least.<br>
&gt;<br>
&gt; [client] ==&gt; [nginx] ==&gt; [service S]<br>
&gt;<br>
&gt; * nginx fronting 2 application servers which provide a service S. (Primary<br>
&gt; and backup, both running Trinidad. Trinidad is a JRuby/Rails wrapper for<br>
&gt; Tomcat.)<br>
<br>
</div>Do you mean &quot;backup&quot; as in &quot;server ... backup;&quot; in upstream<br>
definition?<br>
<div class="im"><br>
&gt; * hot-deploying a rails (jruby) app into Trinidad causes Trinidad to return<br>
&gt; a 404 to nginx<br>
&gt; * nginx returns the 404 to the application. In this particular case, the<br>
&gt; client is another service which expects service S to remain live during<br>
&gt; deployments<br>
&gt;<br>
&gt; So, nginx does provide an &quot;http_404&quot; case for the &quot;proxy_next_upstream&quot;<br>
&gt; directive. However, this would require the &quot;max_fails&quot; setting to pertain to<br>
&gt; 404s, which it doesn&#39;t... otherwise legitimate 404s produce an infinite<br>
&gt; loop.<br>
&gt;<br>
&gt; Is there something like &quot;max_fails&quot; for 404s?<br>
&gt; Is there another solution to this problem?<br>
&gt; Is it Trinidad&#39;s fault for returning 404s and not 503s? (I would say it is<br>
&gt; but I can&#39;t find a solution to that problem just yet.)<br>
<br>
</div>Parameter max_fails is to mark backends down, and you probably<br>
don&#39;t want to mark backends down just because of some<br>
real/legitimate 404&#39;s.<br>
<br>
On the other hand, using &quot;server ... backup&quot; indeed will cause<br>
infinite loop with &quot;proxy_next_upstream http_404&quot;.  It&#39;s a bug, it<br>
should only ask each backend once.<br>
<br>
Workaround is to don&#39;t use &quot;server ... backup&quot; but use either<br>
&quot;weight=&quot; instead (big one for real server, small one for backup<br>
one) or use error_page-based fallback instead.<br>
<font color="#888888"><br>
Maxim Dounin<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>