proxy/smart: remove geoip configuration (unused)
This commit is contained in:
parent
0c8ecae319
commit
21fffa8a91
2 changed files with 0 additions and 99 deletions
|
@ -11,7 +11,6 @@ from app import app
|
|||
from app.extensions import db
|
||||
from app.models.base import Group
|
||||
from app.models.mirrors import Proxy, Origin, SmartProxy
|
||||
from app.terraform.proxy.lib import all_cdn_prefixes
|
||||
from app.terraform.terraform import TerraformAutomation
|
||||
|
||||
|
||||
|
@ -36,10 +35,6 @@ def update_smart_proxy_instance(group_id: int,
|
|||
instance.instance_id = instance_id
|
||||
|
||||
|
||||
def sp_trusted_prefixes() -> str:
|
||||
return "\n".join([f"geoip2_proxy {p};" for p in all_cdn_prefixes()])
|
||||
|
||||
|
||||
class ProxyAutomation(TerraformAutomation):
|
||||
subgroup_members_max = sys.maxsize
|
||||
"""
|
||||
|
@ -106,31 +101,10 @@ class ProxyAutomation(TerraformAutomation):
|
|||
Origin.smart.is_(True)
|
||||
).all()
|
||||
self.tmpl_write(f"smart_proxy.{group.id}.conf", """
|
||||
geoip2 /usr/share/GeoIP/GeoIP2-City.mmdb {
|
||||
auto_reload 5m;
|
||||
$geoip2_metadata_country_build metadata build_epoch;
|
||||
$geoip2_data_country_code default=US country iso_code;
|
||||
}
|
||||
""" + sp_trusted_prefixes() + """
|
||||
geoip2_proxy_recursive on;
|
||||
map $geoip2_data_country_code $redirect_country {
|
||||
default yes;
|
||||
""" + "\n".join([f" {cc} no;" for cc in app.config['CENSORED_COUNTRIES']]) + """
|
||||
}
|
||||
|
||||
{% for origin in origins %}
|
||||
server {
|
||||
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 = 2) {
|
||||
rewrite ^ https://{{ origin.domain_name }}$request_uri? break;
|
||||
}
|
||||
location / {
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_ssl_server_name on;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue