<div dir="ltr">You'll want to proxy_pass to a named upstream with keepalive enabled.<div><br></div><div><a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive">http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 11:33 PM, brookscunningham <span dir="ltr"><<a href="mailto:nginx-forum@forum.nginx.org" target="_blank">nginx-forum@forum.nginx.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello All,<br>
<br>
I am seeing an increase in the number of new TLS connections to my origin<br>
server when using NGINX as a reverse proxy. I am offloading TLS at NGINX and<br>
starting a new TLS connection to the origin.<br>
<br>
The workflow is as follows:<br>
<br>
client --> NGINX --> origin server<br>
<br>
I would expect NGINX to either persist a handful of TLS connection or at a<br>
minimum re-use previously established TLS connections using TLS session<br>
tickets.<br>
However, the behavior that we see is NGINX is apparently opening a new TLS<br>
connection to the origin for nearly every client request. This means going<br>
through the full asymmetric TLS handshake for nearly every request. This is<br>
not desirable for both the latency added and CPU performance hit for going<br>
through the full TLS handshake.<br>
I have validated that my origin server supports TLS Session re-use by using<br>
the following openssl command.<br>
<br>
echo | openssl s_client -tls1_2 -reconnect -state -prexit -connect <my<br>
origin server IP>:443 | grep -i session-id<br>
<br>
Below is the output from "nginx -v"<br>
<br>
nginx version: nginx/1.8.1<br>
<br>
How can I either persist existing TLS connections or leverage TLS session<br>
tickets?<br>
<br>
I found the following link that may be relevant.<br>
<a href="http://hg.nginx.org/nginx/rev/1356a3b96924" rel="noreferrer" target="_blank">http://hg.nginx.org/nginx/rev/<wbr>1356a3b96924</a><br>
<br>
Thanks!<br>
Brooks<br>
<br>
P.S. Below is the relevant proxy configs that I have for my origin server.<br>
<br>
#proxy rules in place for the domain<br>
<br>
proxy_redirect off;<br>
proxy_connect_timeout 15;<br>
proxy_send_timeout 60;<br>
proxy_read_timeout 60;<br>
proxy_buffers 8 16k;<br>
proxy_buffer_size 16k;<br>
proxy_busy_buffers_size 64k;<br>
<br>
proxy_cache XNXFILES;<br>
proxy_cache_use_stale updating error timeout invalid_header http_500<br>
http_502 http_503 http_504;<br>
proxy_cache_valid 301 302 0m;<br>
proxy_cache_valid 200 60m;<br>
proxy_cache_key $host$request_uri;<br>
proxy_http_version 1.1;<br>
proxy_set_header Connection "";<br>
<br>
proxy_set_header Accept-Encoding 'gzip';<br>
<br>
# The variable $host is sets the host request header to the origin server.<br>
proxy_set_header Host $host;<br>
<br>
#The variables REQUEST_PROTO and PROXY_TO are used when determining which<br>
origin to use.<br>
proxy_pass $REQUEST_PROTO://$PROXY_TO;<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,272389,272389#msg-272389" rel="noreferrer" target="_blank">https://forum.nginx.org/read.<wbr>php?2,272389,272389#msg-272389</a><br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>