diff --git a/nginx.conf b/nginx.conf index 88e3709..cac9099 100644 --- a/nginx.conf +++ b/nginx.conf @@ -37,9 +37,14 @@ http { try_files $uri =404; } + # Serve HTML files without .html extension (e.g., /admin -> admin.html) + location ~ ^/([a-zA-Z0-9_-]+)$ { + try_files /$1.html =404; + } + # Serve static files location / { - try_files $uri $uri/ /index.html; + try_files $uri $uri/ =404; # Apply X-Frame-Options to other files add_header X-Frame-Options "SAMEORIGIN" always; } diff --git a/web/admin.html b/web/admin.html index 06c4173..8c684c8 100644 --- a/web/admin.html +++ b/web/admin.html @@ -22,7 +22,7 @@ - @@ -466,7 +466,7 @@ } // No valid cached token, redirect to admin - window.location.href = 'admin.html'; + window.location.href = 'admin'; } function logout() { @@ -475,13 +475,13 @@ localStorage.removeItem('ppr_token_expiry'); accessToken = null; currentUser = null; - window.location.href = 'admin.html'; + window.location.href = 'admin'; } // Enhanced fetch wrapper with token expiry handling async function authenticatedFetch(url, options = {}) { if (!accessToken) { - window.location.href = 'admin.html'; + window.location.href = 'admin'; throw new Error('No access token available'); }