From da386b0e8e715c4510155baa5fcd3b84fddf8583 Mon Sep 17 00:00:00 2001 From: Prashant Shahi Date: Fri, 6 May 2022 09:12:01 +0530 Subject: [PATCH] =?UTF-8?q?chore(nginx-config):=20=F0=9F=94=A7=20=20add=20?= =?UTF-8?q?cache=20control=20headers=20for=20UI=20(#1104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Prashant Shahi --- deploy/docker-swarm/common/nginx-config.conf | 16 +++++++++------- deploy/docker/common/nginx-config.conf | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/deploy/docker-swarm/common/nginx-config.conf b/deploy/docker-swarm/common/nginx-config.conf index f059d3972e6..55a780e0f3d 100644 --- a/deploy/docker-swarm/common/nginx-config.conf +++ b/deploy/docker-swarm/common/nginx-config.conf @@ -1,7 +1,7 @@ server { listen 3301; server_name _; - + gzip on; gzip_static on; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; @@ -12,19 +12,21 @@ server { gzip_http_version 1.1; location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; + add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0"; + add_header Last-Modified $date_gmt; + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; } + location /api { - proxy_pass http://query-service:8080/api; - + proxy_pass http://query-service:8080/api; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { - root /usr/share/nginx/html; + root /usr/share/nginx/html; } } \ No newline at end of file diff --git a/deploy/docker/common/nginx-config.conf b/deploy/docker/common/nginx-config.conf index 3c7a9db8f0e..3444de7808f 100644 --- a/deploy/docker/common/nginx-config.conf +++ b/deploy/docker/common/nginx-config.conf @@ -1,7 +1,7 @@ server { listen 3301; server_name _; - + gzip on; gzip_static on; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; @@ -12,22 +12,25 @@ server { gzip_http_version 1.1; location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; + add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0"; + add_header Last-Modified $date_gmt; + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; } + location /api/alertmanager{ - proxy_pass http://alertmanager:9093/api/v2; + proxy_pass http://alertmanager:9093/api/v2; } + location /api { - proxy_pass http://query-service:8080/api; - + proxy_pass http://query-service:8080/api; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { - root /usr/share/nginx/html; + root /usr/share/nginx/html; } } \ No newline at end of file