diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 1b0cd09..1eb8c1b 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -220,6 +220,11 @@ def post_pref(self, apt_packages, packages, upgrade=False): '{0}/locations-wo.conf' .format(ngxcom), 'locations.mustache', data) + # traffic advice file + WOTemplate.deploy(self, + '/var/www/html/' + '.well-known/traffic-advice', + 'traffic-advice.mustache', data) WOTemplate.deploy(self, '{0}/wpsubdir.conf' diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index 43293bf..c9f2fb2 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -295,11 +295,11 @@ class WOStackUpgradeController(CementBaseController): 'ngxblocker' ]] - if ((not (apt_packages)) and (not(packages))): + if not apt_packages and not packages: self.app.args.print_help() else: pre_stack(self) - if (apt_packages): + if apt_packages: if not ("php7.2-fpm" in apt_packages or "php7.3-fpm" in apt_packages or "php7.4-fpm" in apt_packages or @@ -340,7 +340,7 @@ class WOStackUpgradeController(CementBaseController): Log.valide(self, "Configuring APT Packages") # Post Actions after package updates - if (packages): + if packages: if WOAptGet.is_selected(self, 'WP-CLI', packages): WOFileUtils.rm(self, '/usr/local/bin/wp') diff --git a/wo/cli/templates/locations.mustache b/wo/cli/templates/locations.mustache index b637cfc..2edaaba 100644 --- a/wo/cli/templates/locations.mustache +++ b/wo/cli/templates/locations.mustache @@ -37,6 +37,13 @@ location /.well-known/acme-challenge/ { allow all; auth_basic off; } +# Private Prefetch Proxy +# https://developer.chrome.com/blog/private-prefetch-proxy/ +location /.well-known/traffic-advice { + types { } default_type "application/trafficadvice+json; charset=utf-8"; + alias /var/www/html/.well-known/traffic-advice; + allow all; +} # Return 403 forbidden for readme.(txt|html) or license.(txt|html) or example.(txt|html) or other common git repository files location ~* "/(^$|readme|license|example|README|LEGALNOTICE|INSTALLATION|CHANGELOG)\.(txt|html|md)" { deny all; diff --git a/wo/cli/templates/traffic-advice.mustache b/wo/cli/templates/traffic-advice.mustache new file mode 100644 index 0000000..9e4f8b0 --- /dev/null +++ b/wo/cli/templates/traffic-advice.mustache @@ -0,0 +1,6 @@ +[{ + "user_agent": "prefetch-proxy", + "google_prefetch_proxy_eap": { + "fraction": 1.0 + } +}] \ No newline at end of file