Enable HTTPS production deployment on Sinbad2 via Apache reverse proxy.

This commit is contained in:
Mireya Cueto Garrido
2026-06-03 10:41:02 +02:00
parent 31be326f2c
commit cccbe15275
22 changed files with 264 additions and 28 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
import Axios from 'axios';
import { API_BASE_URL } from '../config';
import { isLoginPath, toAppPath } from './paths';
const api = Axios.create({
baseURL: API_BASE_URL,
@@ -28,8 +29,8 @@ api.interceptors.response.use(
localStorage.removeItem('user');
// SOLUCIÓN: Solo recargamos y redirigimos si NO estamos ya en /login
if (window.location.pathname !== '/login') {
window.location.href = '/login';
if (!isLoginPath(window.location.pathname)) {
window.location.href = toAppPath('/login');
}
}
+19
View File
@@ -0,0 +1,19 @@
const normalizeBasePath = (value) => {
if (!value || value === '/') {
return '';
}
const withLeadingSlash = value.startsWith('/') ? value : `/${value}`;
return withLeadingSlash.replace(/\/$/, '');
};
export const APP_BASE_PATH = normalizeBasePath(import.meta.env.VITE_BASE_PATH);
export const toAppPath = (path) => {
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
return `${APP_BASE_PATH}${normalizedPath}` || normalizedPath;
};
export const isLoginPath = (pathname) => {
const loginPath = toAppPath('/login');
return pathname === loginPath || pathname === '/login';
};