location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $target 'unknown';
if ( $http_cookie ~* "target=(.*)$")
{
set $target $1;
}
if ($domain ~ "target1")
{
proxy_pass http://target1;
break;
}
if ($domain ~ "target2")
{
proxy_pass http://target2;
break;
}
proxy_pass http://dfeualt;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $target 'unknown';
if ( $http_cookie ~* "target=(.*)$")
{
set $target $1;
}
if ($domain ~ "target1")
{
proxy_pass http://target1;
break;
}
if ($domain ~ "target2")
{
proxy_pass http://target2;
break;
}
proxy_pass http://dfeualt;
}