smart proxy: do not redirect when given argument
?redirect=false
This commit is contained in:
parent
2823033e67
commit
5db44e68e9
1 changed files with 7 additions and 1 deletions
|
@ -176,7 +176,7 @@ class ProxyAutomation(TerraformAutomation):
|
|||
}
|
||||
""" + self.sp_trusted_prefixes() + """
|
||||
geoip2_proxy_recursive on;
|
||||
map $geoip2_data_country_code $redirect_country {
|
||||
map $geoip2_data_country_code $redirect_country {
|
||||
default yes;
|
||||
""" + "\n".join([f" {cc} no;" for cc in app.config['CENSORED_COUNTRIES']]) + """
|
||||
}
|
||||
|
@ -186,6 +186,12 @@ class ProxyAutomation(TerraformAutomation):
|
|||
listen 443 ssl;
|
||||
server_name origin-{{ origin.id }}.{{ provider }}.smart.{{ smart_zone[:-1] }};
|
||||
if ($redirect_country = yes) {
|
||||
set $redirect_test 1;
|
||||
}
|
||||
if ($arg_redirect = "false") {
|
||||
set $redirect_test 0;
|
||||
}
|
||||
if ($redirect_test = 1) {
|
||||
rewrite ^ https://{{ origin.domain_name }}$request_uri? break;
|
||||
}
|
||||
location / {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue