From ad0872952199326849894c4b5645de42141e19cb Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Sat, 6 Sep 2025 16:15:59 +0200 Subject: [PATCH] Fix jwt-token --- .env.docker | 9 +++++++-- client/Dockerfile | 6 +++--- docker-compose.yml | 7 +++++-- docker/nginx/default.conf | 20 +++++++++++++------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.env.docker b/.env.docker index 1e09ba2..04b60cf 100644 --- a/.env.docker +++ b/.env.docker @@ -40,5 +40,10 @@ SMTP_PASSWORD= SMTP_FROM= # Frontend Configuration -VITE_API_URL=http://localhost:3002/api -VITE_WS_URL=ws://localhost:3002 +VITE_BASE_PATH=/uggla/ +VITE_API_URL= + +# Debug Configuration +STORE_HEARTBEATS=false +STORE_DRONE_TYPE0=false +LOG_ALL_DETECTIONS=false diff --git a/client/Dockerfile b/client/Dockerfile index 8901379..9bfda90 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -17,13 +17,13 @@ RUN npm install --production=false COPY . . # Build arguments for environment variables -ARG VITE_API_URL=http://localhost:3001/api -ARG VITE_WS_URL=ws://localhost:3001 +ARG VITE_BASE_PATH=/uggla/ +ARG VITE_API_URL ARG NODE_ENV=production # Set environment variables for build +ENV VITE_BASE_PATH=$VITE_BASE_PATH ENV VITE_API_URL=$VITE_API_URL -ENV VITE_WS_URL=$VITE_WS_URL ENV NODE_ENV=$NODE_ENV # Build the application diff --git a/docker-compose.yml b/docker-compose.yml index fd14f69..a641e7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -65,6 +65,9 @@ services: TWILIO_PHONE_NUMBER: ${TWILIO_PHONE_NUMBER} CORS_ORIGIN: http://localhost:3001 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: - "3002:3001" volumes: @@ -89,8 +92,8 @@ services: context: ./client dockerfile: Dockerfile args: - VITE_API_URL: ${VITE_API_URL:-/drones/api} - VITE_WS_URL: ${VITE_WS_URL:-/drones} + VITE_BASE_PATH: ${VITE_BASE_PATH:-/uggla/} + VITE_API_URL: ${VITE_API_URL} NODE_ENV: production container_name: drone-detection-frontend restart: unless-stopped diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index 1e57e8c..9a4f64a 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -25,9 +25,10 @@ server { application/xml+rss application/json; - # Handle React Router (SPA) - location / { - try_files $uri $uri/ /index.html; + # Handle React Router (SPA) - serve from /uggla/ path + location /uggla/ { + alias /usr/share/nginx/html/; + try_files $uri $uri/ /uggla/index.html; # Cache static assets 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 - location /api { - proxy_pass http://backend:3001; + location /uggla/api/ { + proxy_pass http://backend:3001/api/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; @@ -51,8 +57,8 @@ server { } # WebSocket proxy for Socket.IO - location /socket.io/ { - proxy_pass http://backend:3001; + location /uggla/socket.io/ { + proxy_pass http://backend:3001/socket.io/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";