Welcome! Log In Create A New Profile

Advanced

Re: Disable keep_alive based on specific useragent

November 18, 2014 06:26AM
Try to remove the last 's'
This should work.

map $http_user_agent $katimeout {
default 300;
}

On Tue, Nov 18, 2014 at 2:25 AM, Robert Mueller <robm@fastmail.fm> wrote:

> Hi
>
> Thanks for your responses. Unfortunately, they don't seem to work.
>
>
> and then use the evil IF:
>
> if ($ios_ua) {
> keepalive_timout 0;
> }
>
>
> This doesn't appear to work.
>
> if ($http_user_agent ~ "^iOS/8\.") {
> keepalive_timeout 0;
> }
>
> nginx: [emerg] "keepalive_timeout" directive is not allowed here in
> nginx-http.conf:753
> nginx: configuration file nginx-http.conf test failed
>
> If I do:
>
> # if ($http_user_agent ~ "^iOS/8\.") {
> keepalive_timeout 0;
> # }
>
> 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.
>
>
> 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
>
>
> This doesn't seem to work either:
>
> map $http_user_agent $katimeout {
> default 300s;
> }
>
> keepalive_timeout $katimeout;
>
> nginx: [emerg] "keepalive_timeout" directive invalid value in
> nginx-http.conf:53
> nginx: configuration file nginx-http.conf test failed
>
> Looks like the value can't be a variable?
>
> Rob
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Disable keep_alive based on specific useragent

Robert Mueller November 16, 2014 11:54PM

Re: Disable keep_alive based on specific useragent

mex November 17, 2014 01:16AM

Re: Disable keep_alive based on specific useragent

B.R. November 17, 2014 01:44AM

Re: Disable keep_alive based on specific useragent

Robert Mueller November 17, 2014 11:26PM

Re: Disable keep_alive based on specific useragent

wandenberg November 18, 2014 06:26AM

Re: Disable keep_alive based on specific useragent

mex November 18, 2014 07:11AM

Re: Disable keep_alive based on specific useragent

Valentin V. Bartenev November 18, 2014 07:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready