In Nginx can I set Keep-Alive dynamically depending on ssl connection?

Posted by ck_ on Server Fault See other posts from Server Fault or by ck_
Published on 2012-11-27T07:05:45Z Indexed on 2012/11/29 11:09 UTC
Read the original article Hit count: 414

Filed under:
|
|

I would like to avoid having to repeat all the virtualhost server {} blocks in nginx just to have custom ssl settings that vary slightly from plain http requests.

Most ssl directives can be placed right in the main block, except one hurdle I cannot find a workaround for: different keep-alive for https vs http

Is there any way I can use $scheme to dynamically change the keepalive_timeout ?

I've even considered that I can use more_set_input_headers -r 'Keep-Alive: timeout=60'; to conditionally replace the keep-alive timeout only if it already exists, but the problem is $scheme cannot be used in location ie. this is invalid location ^https {}

© Server Fault or respective owner

Related posts about nginx

Related posts about keepalive