From b445d9ddd168948ccacb760ab96fd27c33033042 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 6 Sep 2021 13:45:48 +0200 Subject: [PATCH] set expire headers only for mailu content also moved robots.txt from config to static folder. --- core/nginx/conf/nginx.conf | 16 ++-------------- core/nginx/static/robots.txt | 2 ++ 2 files changed, 4 insertions(+), 14 deletions(-) create mode 100644 core/nginx/static/robots.txt diff --git a/core/nginx/conf/nginx.conf b/core/nginx/conf/nginx.conf index 5a86c34a..4c31674c 100644 --- a/core/nginx/conf/nginx.conf +++ b/core/nginx/conf/nginx.conf @@ -57,11 +57,6 @@ http { proxy_pass http://127.0.0.1:8008; } {% endif %} - # robots.txt - location = /robots.txt { - add_header Content-Type text/plain; - return 200 "User-agent: *\nDisallow: /\n"; - } # redirect to https location / { return 301 https://$host$request_uri; @@ -111,8 +106,6 @@ http { # Remove headers to prevent duplication and information disclosure proxy_hide_header X-XSS-Protection; proxy_hide_header X-Powered-By; - - expires $expires; add_header X-Frame-Options 'SAMEORIGIN'; add_header X-Content-Type-Options 'nosniff'; @@ -132,18 +125,12 @@ http { return 403; } {% else %} - - # robots.txt - location = /robots.txt { - add_header Content-Type text/plain; - return 200 "User-agent: *\nDisallow: /\n"; - } - include /overrides/*.conf; # Actual logic {% if WEB_WEBMAIL != '/' and WEBROOT_REDIRECT != 'none' %} location / { + expires $expires; {% if WEBROOT_REDIRECT %} try_files $uri {{ WEBROOT_REDIRECT }}; {% else %} @@ -198,6 +185,7 @@ http { include /etc/nginx/proxy.conf; proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }}; proxy_pass http://$admin; + expires $expires; } location {{ WEB_ADMIN }}/antispam { diff --git a/core/nginx/static/robots.txt b/core/nginx/static/robots.txt new file mode 100644 index 00000000..1f53798b --- /dev/null +++ b/core/nginx/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /