3

I'm facing the same issue as described in How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass? and thus wanted to apply the same solution.

My NginX, version 1.15.2, config now looks like this:

server {
resolver 127.0.0.1;
set $backend "http://dynamic.example.com:80";
proxy_pass $backend;
}

Upon starting, I see the following error message

[emerg] 11#11: invalid number of arguments in "set" directive in /etc/nginx/conf.d/default.conf:3

Any clues?

ThomasVdBerge
  • 218
  • 3
  • 8
  • Are you sure there's actually a semicolon after the `set` directive? This kind of error usually means a missing ';' at the end of the line. – Daniele Santi Sep 04 '18 at 14:28
  • Yep, this is a direct copy/paste – ThomasVdBerge Sep 04 '18 at 14:31
  • I have the same issue. (see my last question). I'm also using envstub during nginx startup (but for the value which I set so: set $backend "http://$URL"; (where URL is set bij envstub). Any idea on this? – DenCowboy Sep 04 '18 at 15:50

1 Answers1

4

The Nginx config itself was indeed correct.

The problem I had was envsubst also replacing the $backend variable with an empty space.

ThomasVdBerge
  • 218
  • 3
  • 8