diff --git a/FIX_REDIRECT_LOOP.md b/FIX_REDIRECT_LOOP.md index b43f4f2..bf6ab09 100644 --- a/FIX_REDIRECT_LOOP.md +++ b/FIX_REDIRECT_LOOP.md @@ -3,8 +3,9 @@ ## Masalah Dari curl test: + ``` -HTTP/2 302 +HTTP/2 302 location: ../index.php ``` @@ -39,11 +40,13 @@ cat /etc/nginx/conf.d/retribusi.conf ``` Pastikan ada: + ```nginx root /www/wwwroot/retribusi.btekno.cloud/retribusi/public; ``` **BUKAN**: + ```nginx root /www/wwwroot/retribusi.btekno.cloud/retribusi; # SALAH! ``` @@ -79,4 +82,3 @@ Seharusnya sekarang tidak ada redirect 302 lagi. - [ ] Nginx sudah di-reload - [ ] Test curl tidak ada redirect 302 - [ ] Browser cache sudah di-clear - diff --git a/README.md b/README.md index 5c18041..28b33b9 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ File `public/dashboard/js/config.js` mengatur: 1. Pastikan backend API sudah running 2. Set document root ke folder `public/` -3. Buka `index.php` untuk login (atau akses root `/`) +3. Buka `index.html` untuk login (atau akses root `/`) 4. Akses dashboard di `dashboard/dashboard.html` ## Production diff --git a/public/dashboard/event.html b/public/dashboard/event.html index c50e483..5912dc8 100644 --- a/public/dashboard/event.html +++ b/public/dashboard/event.html @@ -237,12 +237,14 @@ // Check auth if (!Auth.isAuthenticated()) { const currentPath = window.location.pathname.toLowerCase(); - const isLoginPage = currentPath.includes('index.php') || + const isLoginPage = currentPath.includes('index.html') || + currentPath.includes('index.php') || currentPath === '/' || + currentPath === '/index.html' || currentPath === '/index.php'; // Hanya redirect jika belum di login page if (!isLoginPage) { - window.location.href = '../index.php'; + window.location.href = '../index.html'; } } diff --git a/public/dashboard/js/api.js b/public/dashboard/js/api.js index 521e0da..c168596 100644 --- a/public/dashboard/js/api.js +++ b/public/dashboard/js/api.js @@ -42,14 +42,16 @@ async function apiRequest(path, options = {}) { localStorage.removeItem('user'); // Cek apakah sudah di login page untuk menghindari redirect loop const currentPath = window.location.pathname.toLowerCase(); - const isLoginPage = currentPath.includes('index.php') || + const isLoginPage = currentPath.includes('index.html') || + currentPath.includes('index.php') || currentPath === '/' || + currentPath === '/index.html' || currentPath === '/index.php' || currentPath.endsWith('/') || currentPath === ''; // Hanya redirect jika benar-benar di halaman dashboard, bukan di login page if (!isLoginPage && currentPath.includes('dashboard')) { - window.location.href = '../index.php'; + window.location.href = '../index.html'; } throw new Error('Unauthorized'); } diff --git a/public/dashboard/js/auth.js b/public/dashboard/js/auth.js index 79e0c72..c0d6170 100644 --- a/public/dashboard/js/auth.js +++ b/public/dashboard/js/auth.js @@ -23,7 +23,7 @@ export const Auth = { localStorage.removeItem(TOKEN_KEY); localStorage.removeItem(USER_KEY); sessionStorage.removeItem('auth_redirect_done'); - window.location.href = '../index.php'; + window.location.href = '../index.html'; } }; diff --git a/public/dashboard/js/dashboard.js b/public/dashboard/js/dashboard.js index 179a6b9..caac8e2 100644 --- a/public/dashboard/js/dashboard.js +++ b/public/dashboard/js/dashboard.js @@ -697,8 +697,10 @@ document.addEventListener('DOMContentLoaded', async () => { if (!Auth.isAuthenticated()) { // Cek apakah sudah di login page untuk mencegah redirect loop const currentPath = window.location.pathname.toLowerCase(); - const isLoginPage = currentPath.includes('index.php') || + const isLoginPage = currentPath.includes('index.html') || + currentPath.includes('index.php') || currentPath === '/' || + currentPath === '/index.html' || currentPath === '/index.php' || currentPath.endsWith('/') || currentPath === ''; @@ -706,7 +708,7 @@ document.addEventListener('DOMContentLoaded', async () => { // JANGAN redirect jika sudah di login page atau root if (!isLoginPage && currentPath.includes('dashboard')) { // Hanya redirect jika benar-benar di halaman dashboard - window.location.href = '../index.php'; + window.location.href = '../index.html'; } return; } diff --git a/public/dashboard/settings.html b/public/dashboard/settings.html index acdb5d9..ffb479d 100644 --- a/public/dashboard/settings.html +++ b/public/dashboard/settings.html @@ -571,12 +571,14 @@ // Check auth if (!Auth.isAuthenticated()) { const currentPath = window.location.pathname.toLowerCase(); - const isLoginPage = currentPath.includes('index.php') || + const isLoginPage = currentPath.includes('index.html') || + currentPath.includes('index.php') || currentPath === '/' || + currentPath === '/index.html' || currentPath === '/index.php'; // Hanya redirect jika belum di login page if (!isLoginPage) { - window.location.href = '../index.php'; + window.location.href = '../index.html'; } } diff --git a/public/index.php b/public/index.html similarity index 100% rename from public/index.php rename to public/index.html