If such values are in a variable you should be able to use that, ea.
if $val1 = "groupa" set $ppass '1234';
proxy_pass http://$backend:$ppass;
nb. this is not real config code but an example.
if $val1 = "groupa" set $ppass '1234';
proxy_pass http://$backend:$ppass;
nb. this is not real config code but an example.