Fix jwt-token

This commit is contained in:
2025-09-06 16:15:59 +02:00
parent 4287a63b8d
commit ad08729521
4 changed files with 28 additions and 14 deletions

View File

@@ -40,5 +40,10 @@ SMTP_PASSWORD=
SMTP_FROM= SMTP_FROM=
# Frontend Configuration # Frontend Configuration
VITE_API_URL=http://localhost:3002/api VITE_BASE_PATH=/uggla/
VITE_WS_URL=ws://localhost:3002 VITE_API_URL=
# Debug Configuration
STORE_HEARTBEATS=false
STORE_DRONE_TYPE0=false
LOG_ALL_DETECTIONS=false

View File

@@ -17,13 +17,13 @@ RUN npm install --production=false
COPY . . COPY . .
# Build arguments for environment variables # Build arguments for environment variables
ARG VITE_API_URL=http://localhost:3001/api ARG VITE_BASE_PATH=/uggla/
ARG VITE_WS_URL=ws://localhost:3001 ARG VITE_API_URL
ARG NODE_ENV=production ARG NODE_ENV=production
# Set environment variables for build # Set environment variables for build
ENV VITE_BASE_PATH=$VITE_BASE_PATH
ENV VITE_API_URL=$VITE_API_URL ENV VITE_API_URL=$VITE_API_URL
ENV VITE_WS_URL=$VITE_WS_URL
ENV NODE_ENV=$NODE_ENV ENV NODE_ENV=$NODE_ENV
# Build the application # Build the application

View File

@@ -65,6 +65,9 @@ services:
TWILIO_PHONE_NUMBER: ${TWILIO_PHONE_NUMBER} TWILIO_PHONE_NUMBER: ${TWILIO_PHONE_NUMBER}
CORS_ORIGIN: http://localhost:3001 CORS_ORIGIN: http://localhost:3001
API_DEBUG: ${API_DEBUG:-false} API_DEBUG: ${API_DEBUG:-false}
STORE_HEARTBEATS: ${STORE_HEARTBEATS:-false}
STORE_DRONE_TYPE0: ${STORE_DRONE_TYPE0:-false}
LOG_ALL_DETECTIONS: ${LOG_ALL_DETECTIONS:-false}
ports: ports:
- "3002:3001" - "3002:3001"
volumes: volumes:
@@ -89,8 +92,8 @@ services:
context: ./client context: ./client
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
VITE_API_URL: ${VITE_API_URL:-/drones/api} VITE_BASE_PATH: ${VITE_BASE_PATH:-/uggla/}
VITE_WS_URL: ${VITE_WS_URL:-/drones} VITE_API_URL: ${VITE_API_URL}
NODE_ENV: production NODE_ENV: production
container_name: drone-detection-frontend container_name: drone-detection-frontend
restart: unless-stopped restart: unless-stopped

View File

@@ -25,9 +25,10 @@ server {
application/xml+rss application/xml+rss
application/json; application/json;
# Handle React Router (SPA) # Handle React Router (SPA) - serve from /uggla/ path
location / { location /uggla/ {
try_files $uri $uri/ /index.html; alias /usr/share/nginx/html/;
try_files $uri $uri/ /uggla/index.html;
# Cache static assets # Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
@@ -36,9 +37,14 @@ server {
} }
} }
# Root redirect to uggla
location = / {
return 301 /uggla/;
}
# Proxy API requests to backend # Proxy API requests to backend
location /api { location /uggla/api/ {
proxy_pass http://backend:3001; proxy_pass http://backend:3001/api/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade'; proxy_set_header Connection 'upgrade';
@@ -51,8 +57,8 @@ server {
} }
# WebSocket proxy for Socket.IO # WebSocket proxy for Socket.IO
location /socket.io/ { location /uggla/socket.io/ {
proxy_pass http://backend:3001; proxy_pass http://backend:3001/socket.io/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";