From e821c4d26a1a488b15b90dfe22c6210d58c70b98 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 19 Mar 2023 11:51:50 +0100 Subject: [PATCH] replace http header link by sub_filter link --- roles/deploy-web/files/gouter | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/deploy-web/files/gouter b/roles/deploy-web/files/gouter index ab5becd..5bf34dd 100644 --- a/roles/deploy-web/files/gouter +++ b/roles/deploy-web/files/gouter @@ -7,14 +7,16 @@ server { if ($host = clarissariviere.com) { return 301 https://"www.clarissariviere.com"$request_uri; } # managed by Certbot - - + set $link 'canonical'; + if ($host = www.clarissariviere.fr) { + set $link "alternate\" hreflang=\"fr"; + } access_log /var/log/nginx/clarissa_access.log main; error_log /var/log/nginx/clarissa_error.log; #gzip_static off; server_name clarissariviere.com clarissariviere.fr www.clarissariviere.fr www.clarissariviere.com; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; - add_header Link " rel=\"canonical\", rel=\"alternate\" hreflang=\"fr\""; + #add_header Link " rel=\"canonical\", rel=\"alternate\" hreflang=\"fr\""; proxy_cache STATIC; location / { # First attempt to serve request as file, then @@ -36,9 +38,9 @@ server { #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header X-Forwarded-Proto $scheme; + sub_filter 'canonical' "$link"; sub_filter 'gouters.canalblog.com' "$host"; sub_filter '' ''; - #sub_filter '' ''; sub_filter_types text/html text/xml text/plain text/css; sub_filter_once off;