Skip to content

Commit

Permalink
Merge pull request #3030 from LiteFarmOrg/LF-3921d-update-nginx-confi…
Browse files Browse the repository at this point in the history
…guration-to-match-vite-pwa-recommendations

LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error
  • Loading branch information
SayakaOno authored and antsgar committed Dec 12, 2023
1 parent 9bcec03 commit 5ed4719
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/webapp/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,37 @@ http {

server {
server_name beta.litefarm.org;
root /var/www/litefarm;

location = /index.html {
add_header Cache-Control "public, max-age=0, must-revalidate" always;
}

location = /manifest.webmanifest {
add_header Cache-Control "public, max-age=0, must-revalidate" always;
}

location = /sw.js {
add_header Cache-Control "public, max-age=0, must-revalidate" always;
}

# Set Cache-Control for various pwa-critical routes
# See https://vite-pwa-org.netlify.app/deployment/nginx.html#cache-control
location ^~ /assets/ {
root /var/www/litefarm;
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
try_files $uri =404;
}

location ^~ /workbox- {
root /var/www/litefarm;
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
try_files $uri =404;
}

location / {
autoindex off;
expires off;
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
try_files $uri /index.html;
try_files $uri /index.html =404;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/beta.litefarm.org/fullchain.pem; # managed by Certbot
Expand Down

0 comments on commit 5ed4719

Please sign in to comment.