From dee5d38b58fd303447bb0566cd56556e094be4e4 Mon Sep 17 00:00:00 2001 From: James Pattinson Date: Thu, 18 Dec 2025 10:46:18 -0500 Subject: [PATCH] URL tidy --- nginx.conf | 7 ++++++- web/admin.html | 2 +- web/reports.html | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) 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'); }