Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion web-ui/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import TlsManagement from './pages/TlsManagement'
export default function App() {
const { isAuthenticated } = useAuth()

const getBasename = () => {
const path = window.location.pathname;
const idx = path.indexOf('/tls-manager');
return idx !== -1 ? path.substring(0, idx + '/tls-manager'.length) : '/tls-manager';
};

return (
<NotificationProvider>
<BrowserRouter basename="/tls-manager">
<BrowserRouter basename={getBasename()}>
<Routes>
<Route
path="/login"
Expand Down
8 changes: 7 additions & 1 deletion web-ui/src/services/api.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import axios from 'axios'

const getBasename = () => {
const path = window.location.pathname;
const idx = path.indexOf('/tls-manager');
return idx !== -1 ? path.substring(0, idx) : '/';
};

export const api = axios.create({
// Use same-origin '/api' in dev with Vite proxy; fallback to absolute BASE_URL when building
baseURL: '/',
baseURL: getBasename(),
withCredentials: true,
headers: {
'X-Requested-With': 'XMLHttpRequest',
Expand Down
2 changes: 1 addition & 1 deletion web-ui/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
base: '/tls-manager/',
base: './',
server: {
allowedHosts: ['localhost', '127.0.0.1', '0.0.0.0', '778ded44be8d.ngrok-free.app'],
proxy: {
Expand Down