0

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.

Adam
  • 121
  • 7
  • Does this answer your question? [nginx set variable in location](https://serverfault.com/questions/644892/nginx-set-variable-in-location) – AlexD Jan 03 '22 at 12:29
  • Also see http://nginx.org/en/docs/faq/variables_in_config.html – AlexD Jan 03 '22 at 12:31
  • @AlexD, the problem isn't in setting the variable but set_real_ip_from isn't taking the variable and returning an error. – Adam Jan 03 '22 at 13:25

0 Answers0