I want to do a geoip lookup only when a "location" cookie doesn't exist, and then only when Nginx isn't serving the file for me. Everything works except for the conditional (I know about the IfisEvil etc - this is shown for the logic ....)
Is there a way to achieve what I am trying to do in this example?
location @app {
if ($http_cookie !~* "location") {
proxy_set_header Country-Name $geoip_country_name;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://upstream_server;
}
Many thanks.