<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Hi<br></div>
<div> </div>
<div>Thanks for your responses. Unfortunately, they don't seem to work.<br></div>
<div> </div>
<blockquote><div>and then use the evil IF:<br></div>
<div> </div>
<div>if ($ios_ua) {<br></div>
<div> keepalive_timout 0;<br></div>
<div>}<br></div>
</blockquote><div> </div>
<div>This doesn't appear to work.<br></div>
<div> </div>
<div> if ($http_user_agent ~ "^iOS/8\.") {<br></div>
<div> keepalive_timeout 0;<br></div>
<div> }<br></div>
<div> </div>
<div>nginx: [emerg] "keepalive_timeout" directive is not allowed here in nginx-http.conf:753<br></div>
<div>nginx: configuration file nginx-http.conf test failed<br></div>
<div> </div>
<div>If I do:<br></div>
<div> </div>
<div> # if ($http_user_agent ~ "^iOS/8\.") {<br></div>
<div> keepalive_timeout 0;<br></div>
<div> # }<br></div>
<div> </div>
<div>e.g. comment out the "if" block part, it works fine, but obviously disabled keepalive for all requests. So it appears you can't set keepalive_timeout in an "if" block.<br></div>
<div> </div>
<blockquote><div dir="ltr"><div><div defang_data-gmailquote="yes"><div style="font-size:small;color:rgb(51,51,153)"><div style="font-size:small;color:rgb(51,51,153);display:inline">I would do even better by avoiding using 'if'<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> at all:<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> </div>
<div style="font-size:small;color:rgb(51,51,153);display:inline">map $http_user_agent $keepalive_timeout {<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> default 75s; # Put here the wanted default value (taken from <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout" target="_blank">keepalive_timeout</a> docs)<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> *regex* 0;<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> *for* 0;<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> *blacklisted* 0;<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> *user agents* 0<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline">}<br></div>
<div style="font-size:small;color:rgb(51,51,153);display:inline"> </div>
<div style="font-size:small;color:rgb(51,51,153);display:inline">keepalive_timeout $keepalive_timeout; # At http, server or location level, as docs state<br></div>
</div>
</div>
</div>
</div>
</blockquote><div> </div>
<div>This doesn't seem to work either:<br></div>
<div> </div>
<div> map $http_user_agent $katimeout {<br></div>
<div> default 300s;<br></div>
<div> }<br></div>
<div> </div>
<div> keepalive_timeout $katimeout;<br></div>
<div> </div>
<div>nginx: [emerg] "keepalive_timeout" directive invalid value in nginx-http.conf:53<br></div>
<div>nginx: configuration file nginx-http.conf test failed<br></div>
<div> </div>
<div>Looks like the value can't be a variable?<br></div>
<div> </div>
<div>Rob<br></div>
<div> </div>
</body>
</html>