'Valid characters in nginx upstream name
In an upstream configuration like this:
upstream name {
...
}
I'm wondering what characters can be used in the name. Does it have to be alphanumeric or are there other characters that are also allowed?
Solution 1:[1]
Here's the code that reads a token from configuration file: https://github.com/nginx/nginx/blob/master/src/core/ngx_conf_file.c#L771
Seems that you can use any characters you like, except for spaces, tabs, and variable interpolations. (you can use spaces and tabs if you wrap the upstream name in quotes or escape the characters where necessary).
I've got this abomination to work, so it seems that nginx is fairly liberal in terms of what characters are acceptable:
upstream x_2.2-34%15=54^1@2!&3()4aoeu't {
server 127.0.0.1:8086;
}
server {
location / {
proxy_pass http://x_2.2-34%15=54^1@2!&3()4aoeu't;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rogach |