Score:0

Nginx "set_real_ip_from" use value from a local variable

us flag

I'm trying to set the value of set_real_ip_from from a variable but I'm getting an error.

NGINX Config:

set $frontendIP "104.22.100.4/32";

set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;

set_real_ip_from $frontendIP;

Error:

nginx: [emerg] host not found in set_real_ip_from "$frontendIP"

The problem is not in setting the variable, but set_real_ip_from returning an error.

jp flag
Does this answer your question? [nginx set variable in location](https://serverfault.com/questions/644892/nginx-set-variable-in-location)
jp flag
Also see http://nginx.org/en/docs/faq/variables_in_config.html
Adam avatar
us flag
@AlexD, the problem isn't in setting the variable but set_real_ip_from isn't taking the variable and returning an error.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.