<div dir="ltr">It sounds like this is not as straight forward as I had hoped, I'll do like Francis Daly said and put together a test case - I'll get some packet captures to see what exactly is being sent between all the components.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 15, 2016 at 4:49 PM, Валентин Бартенев <span dir="ltr"><<a href="mailto:vbart@nginx.com" target="_blank">vbart@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thursday 14 April 2016 22:45:36 CJ Ess wrote:<br>
> In my environment I have Nginx terminating connections, then sending them<br>
> to an HAProxy upstream. We've noticed that whenever HAProxy emts a 403<br>
> error (Forbidden, in response to our ACL rules), NGINX reports a 503 result<br>
> (service unavailable) and I believe is logging an "upstream prematurely<br>
> closed connection while reading response header from upstream" error<br>
> message in the nginx error log.<br>
><br>
> What I'd really like to do is pass the 403 code back to the user - what do<br>
> I need to do?<br>
<br>
</div></div>That message suggests that haproxy closes connection before properly returning<br>
headers.  So nginx can't pass 403 since it can't get it right from haproxy.<br>
<br>
You should check what is wrong with haproxy.<br>
<br>
  wbr, Valentin V. Bartenev<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>