diff --git a/nginx.conf b/nginx.conf index 13da466..a2c0d11 100644 --- a/nginx.conf +++ b/nginx.conf @@ -52,27 +52,34 @@ http { } server { - listen 80; + listen 80; listen [::]:80; root /usr/share/nginx/html; index indexV2.html; - access_log /dev/stdout; - error_log /dev/stderr error; + access_log /dev/stdout; + error_log /dev/stderr error; expires $cache_expires; - location / { - try_files $uri /indexV2.html; - } - + # Redirect old /index.html requests to new file location = /index.html { return 301 /indexV2.html; } + # Serve indexV2.html directly without redirect loop + location = /indexV2.html { + root /usr/share/nginx/html; + } + + # Fallback for SPA routing — all unmatched routes go to indexV2.html + location / { + try_files $uri /indexV2.html; + } } + # Healthcheck server { listen 8080; diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx index 8236074..972f451 100644 --- a/src/pages/Devices.tsx +++ b/src/pages/Devices.tsx @@ -151,18 +151,11 @@ export default function Devices() { const groupID = useParams<{ groupID: string }>()?.groupID ?? "all"; // const [tab, setTab] = useState(groupID==="all" ? groupID : groupID); const [tab, setTab] = useState(() => { - console.log("groupID: "+groupID) if (groupID!=="all") return groupID const stored = sessionStorage.getItem(location.pathname+"-groups-tab"); - console.log("stored: "+stored) return stored !== null ? stored : "all"; }); - useEffect(() => { - console.log(tab) - sessionStorage.setItem(location.pathname+"-groups-tab", tab); - }, [tab]); - const [selectedGroup, setSelectedGroup] = useState(undefined); const [groupSettingsMode, setGroupSettingsMode] = useState< "add" | "update" | "remove" | undefined @@ -373,10 +366,6 @@ export default function Devices() { return '/' + newSegments.join('/'); } - // useEffect(() => { - // console.log(devices) - // }, [devices]) - const toDevice = (device: Device) => { let url = getGroup() ? insertGroupContext(getGroup().id().toString(), device.id().toString()) : "" if (url.length < 1) url = device.id().toString() @@ -724,10 +713,6 @@ export default function Devices() { ) } - useEffect(() => { - console.log('Current tab value:', tab, typeof tab); - }, [tab]); - if (!groupsLoaded) return ( )