mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
не факт что заработает) в2
This commit is contained in:
@@ -5,7 +5,16 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
# Важно: этот блок должен быть перед location /
|
# Все маршруты должны обрабатываться через index.html для SPA
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-Frame-Options DENY;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
}
|
||||||
|
|
||||||
|
# API прокси
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://backend:8000/api/;
|
proxy_pass http://backend:8000/api/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
@@ -13,16 +22,19 @@ server {
|
|||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_connect_timeout 60s;
|
|
||||||
proxy_send_timeout 60s;
|
# Увеличим таймауты для отладки
|
||||||
proxy_read_timeout 60s;
|
proxy_connect_timeout 120s;
|
||||||
|
proxy_send_timeout 120s;
|
||||||
|
proxy_read_timeout 120s;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Обработка всех остальных маршрутов
|
# Явно запретим доступ к .git и другим служебным директориям
|
||||||
location / {
|
location ~ /\. {
|
||||||
try_files $uri $uri/ /index.html;
|
deny all;
|
||||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
||||||
add_header Pragma "no-cache";
|
|
||||||
add_header Expires "0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Обработка ошибок
|
||||||
|
error_page 404 /index.html;
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
}
|
}
|
||||||
@@ -13,26 +13,36 @@ const router = createRouter({
|
|||||||
{
|
{
|
||||||
path: '/support',
|
path: '/support',
|
||||||
name: 'support',
|
name: 'support',
|
||||||
|
// Ошибка: Не найден модуль '../views/SupportView.vue'
|
||||||
component: () => import('../views/SupportView.vue'),
|
component: () => import('../views/SupportView.vue'),
|
||||||
meta: { requiresAuth: true }
|
meta: { requiresAuth: true }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/admin',
|
path: '/admin',
|
||||||
name: 'admin-login',
|
name: 'admin-login',
|
||||||
|
// Ошибка: Не найден модуль '../views/admin/AdminLoginView.vue'
|
||||||
component: () => import('../views/admin/AdminLoginView.vue')
|
component: () => import('../views/admin/AdminLoginView.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/admin/dashboard',
|
path: '/admin/dashboard',
|
||||||
name: 'admin-dashboard',
|
name: 'admin-dashboard',
|
||||||
|
// Ошибка: Не найден модуль '../views/admin/DashboardView.vue'
|
||||||
component: () => import('../views/admin/DashboardView.vue'),
|
component: () => import('../views/admin/DashboardView.vue'),
|
||||||
meta: { requiresAdmin: true }
|
meta: { requiresAdmin: true }
|
||||||
},
|
|
||||||
// Добавим catch-all маршрут для 404
|
|
||||||
{
|
|
||||||
path: '/:pathMatch(.*)*',
|
|
||||||
redirect: '/'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Остальной код router.ts остается без изменений
|
router.beforeEach((to, _, next) => {
|
||||||
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
|
if (to.meta.requiresAuth && !authStore.isAuthenticated) {
|
||||||
|
next({ name: 'login' });
|
||||||
|
} else if (to.meta.requiresAdmin && !authStore.isAdmin) {
|
||||||
|
next({ name: 'admin-login' });
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
Reference in New Issue
Block a user