load balancing - Setup dynamic upstream with nginx -
suppose have upstream source
upstream first { } upstream second { }
and in server
block
map $geoip_country_code $is_china { default no; cn yes; }
what achieve if $is_china
, use different upstream
proxy_pass http://$preferred_host/;
i can't figure how nginx.
map
might sufficient. have tried following?
map $geoip_country_code $preferred_host { default first; cn second; }
Comments
Post a Comment