Welcome! Log In Create A New Profile

Advanced

Re: Storing $server_addr in a variable VS using it directly in location block

Valentin V. Bartenev
July 15, 2015 07:10AM
On Tuesday 14 July 2015 21:46:58 justink101 wrote:
> According to the documentation getting the value of $server_addr to set a
> response header makes a system call, and can impact performance
> negativelyset $ip $server_addr;
>
> server {
> location /health {
> add_header Backend $server_addr;
> return 200;
> }
> }
>
> Would the following be a better solution, and eliminate the system call on
> every request?
>
> server {
> set $ip $server_addr;
>
> location /health {
> add_header Backend $ip always;
> return 200;
> }
> }
>

No, it wouldn't. The "set" directive also is executed on every request.

wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Storing $server_addr in a variable VS using it directly in location block

justink101 July 14, 2015 09:46PM

Re: Storing $server_addr in a variable VS using it directly in location block

Valentin V. Bartenev July 15, 2015 07:10AM

Re: Storing $server_addr in a variable VS using it directly in location block

itpp2012 July 15, 2015 07:45AM

Re: Storing $server_addr in a variable VS using it directly in location block

Valentin V. Bartenev July 15, 2015 08:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 237
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