Disable keep_alive based on specific useragent
B.R.
reallfqq-nginx at yahoo.fr
Mon Nov 17 06:41:38 UTC 2014
Hello,
On Mon, Nov 17, 2014 at 7:16 AM, mex <nginx-forum at nginx.us> wrote:
> map $http_user_agent $ios8_ua {
> default 0;
> "YOUR_REGEX_HERE" 1;
> }
>
> and then use the evil IF:
>
> if ($ios_ua) {
> keepalive_timout 0;
> }
>
I would do even better by avoiding using 'if'
at all:
map $http_user_agent $keepalive_timeout {
default 75s; # Put here the wanted default value (taken from
keepalive_timeout
<http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout>
docs)
*regex* 0;
*for* 0;
*blacklisted* 0;
*user agents* 0;
}
keepalive_timeout $keepalive_timeout; # At http, server or location level,
as docs state
---
*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141117/878c20bb/attachment.html>
More information about the nginx
mailing list