Browse Source

fix(nginx): optimize for prerendered content and set charset to utf-8

unknown 12 hours ago
parent
commit
17d85ea572
1 changed files with 6 additions and 2 deletions
  1. 6 2
      nginx.conf

+ 6 - 2
nginx.conf

@@ -3,10 +3,11 @@ server {
 
     root /var/www/radionica3d/dist;
     index index.html;
+    charset utf-8;
 
     # Gzip Compression
     gzip on;
-    gzip_static on;
+    gzip_static on; # Serve .gz files if they exist
     gzip_vary on;
     gzip_proxied any;
     gzip_comp_level 6;
@@ -21,8 +22,11 @@ server {
     add_header Referrer-Policy "strict-origin-when-cross-origin";
     # add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
 
+    # SEO & Prerendering Optimization
     location / {
-        try_files $uri $uri/ /index.html;
+        # First attempt to serve request as file, then as directory/index.html, 
+        # then fall back to the main index.html (SPA)
+        try_files $uri $uri/index.html /index.html;
         
         # Caching for index.html (don't cache)
         location = /index.html {