Hi everyone,
I'm hoping someone can help me with the following problem:
I'm trying to build up the url used in proxy_pass so it can handle multiple brands and team names in our dev environment. My nginx.conf file looks like this:
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name ~^(www\.)?(?<brand>\w+)\.(?<team>\w+)\..*$;
location / {
proxy_set_header Host www.$brand.$team.dev;
proxy_pass http://vmware-$team.dev;
}
}
}
The reason we want to do this is so multiple teams can be routed through to their own INT server.
An example request could be www.brandA.teamB.dev and i want to rout this through to http://vmware-teamB.dev.
If i hardcode 'http://vmware-teamB.dev' as the proxy_pass value it works, but when trying to use the variable I get the following error:
[error] 5#5: *1 no resolver defined to resolve vmware-teamB.dev, client: 192.168.99.1, server: ~^(www\.)?(?<brand>\w+)\.(?<team>\w+)\..*$, request: "GET / HTTP/1.1", host: "www.brandA.teamB.dev"
192.168.99.1 - - [05/Jul/2016:13:39:58 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
2016/07/05 13:39:58 [error] 5#5: *1 no resolver defined to resolve vmware-teamB.dev, client: 192.168.99.1, server: ~^(www\.)?(?<brand>\w+)\.(?<team>\w+)\..*$, request: "GET /favicon.ico HTTP/1.1", host: "www.brandA.teamB.dev", referrer: "http://www.brandA.teamB.dev/"
192.168.99.1 - - [05/Jul/2016:13:39:58 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://www.brandA.teamB.dev/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
Can anyone please help? Am i allowed the build up a url like this?
Many thanks,
Mike