<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">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">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>