<div dir="ltr"><div><div><div>Hi, <br></div>sucha setup is on 1stproxy, there I have upstream defined to second proxy and it works - connection is reused.<br></div>problem is that it is chain of forward proxy with caching, and <a href="http://your-server.com">your-server.com</a> including port is different - service:port is dynamic. <br></div><div>I'm asking for it, because with firefox (set global proxy to my second proxy) I go to some <a href="http://blabla.your-server.com">blabla.your-server.com</a> connection is kept</div><div>in a meaning that on server side I see only one established connection, and all of requests that I make from firefox are made over this keept connection. Problem starts when I will use chain of proxies (all nginx).</div><div><br></div><div>regards</div><div><div><div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Łukasz Tasz<br></div><div>RTKW<br></div></div></div></div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">czw., 8 paź 2020 o 11:43 Marcin Wanat <<a href="mailto:marcin.wanat@gmail.com">marcin.wanat@gmail.com</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 11:36 AM Łukasz Tasz <<a href="mailto:lukasz@tasz.eu" target="_blank">lukasz@tasz.eu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi all, <br></div><div><br></div>can I expect that proxy_pass will keep connection to remote server that is being proxied?<br><div><br></div><div>when I'm using setup client -> proxy -> server it looks to work<br></div><div>but when I'm using:<br></div><div>client -> 1stProxy_upstream -> proxy -> server<br></div><div>connection between 1stProxy and proxy is being kept thanks to keepalive 100, but proxy makes new connection every new request, very simple setup:<br><br></div><div>http {<br> server {<br> listen 8080;<br> location / {<br> keepalive_disable none;<br> keepalive_requests 1000;<br> keepalive_timeout 300s;<br> proxy_cache proxy-cache;<br> proxy_cache_valid 200 302 301 30m;<br> proxy_cache_valid any 1m;<br> proxy_cache_key $scheme://$http_host$request_uri;<br> proxy_pass $scheme://$http_host$request_uri;<br> proxy_http_version 1.1;<br> proxy_set_header Connection "";<br> }<br> }<br>}</div><div>I would expect that when client connects proxy and it works then it should also works when proxy connects upstream proxy....</div></div></blockquote><div><br></div><div>For keepalive in upstream proxy you shoud use upstream configuration block and configure keepalive in it:<br><br> upstream backend {<br> zone backend 1m;<br> server <a href="http://your-server.com" target="_blank">your-server.com</a>;<br> keepalive 128;<br>}</div><div><br></div><div>
server {<br> listen 8080;<br> location / {<br> proxy_cache proxy-cache;<br> proxy_cache_valid 200 302 301 30m;<br> proxy_cache_valid any 1m;<br> proxy_cache_key $scheme://$http_host$request_uri;<br> proxy_pass $scheme://backend$request_uri;<br> proxy_http_version 1.1;<br> proxy_set_header Connection "";<br> }<br> } <br></div><div><br></div><div>--</div><div>Marcin Wanat<br></div></div></div>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">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></blockquote></div>