Igor,<div>Is this correct?</div><div><br></div><div><div>set $country_code $arg_country;</div><div>set_if_empty $country_code $geoip_country_code;</div><div>proxy_set_header   X-Country-Code   $country_code; </div><div><br>
</div><br><div class="gmail_quote">On Mon, Oct 15, 2012 at 1:35 PM, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru" target="_blank">igor@sysoev.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Sun, Oct 14, 2012 at 11:30:22AM -0700, Quintin Par wrote:<br>
> Hi all,<br>
><br>
> I set the some params to my backend server as shown below<br>
><br>
> set_if_empty $country_code $http_x_country_code;<br>
><br>
> proxy_set_header   X-Country-Code   $country_code;<br>
><br>
> Now the http_x_country_code comes via the GeoIP module.<br>
><br>
> Is there a way here I can override this based on an HTTP param I can set.<br>
><br>
> Say <a href="http://site.com/country=US" target="_blank">site.com/country=US</a> and country variable has greater precedence over<br>
> the http_x_country_code.<br>
<br>
</div></div>Using "map" you can define:<br>
<br>
http {<br>
<br>
    map  $arg_country          $country_code {<br>
         ""                    $header_country;<br>
         default               $arg_country;<br>
    }<br>
<br>
    map  $http_x_country_code  $header_country {<br>
         ""                    $geoip_country_code;<br>
         default               $http_x_country_code;<br>
    }<br>
<br>
    ...<br>
<br>
    location / {<br>
        proxy_set_header  X-Country-Code   $country_code;<br>
        ...<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<a href="http://nginx.com/support.html" target="_blank">http://nginx.com/support.html</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br></div>