July 14, 2015 09:46PM
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;
}
}
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: 154
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