From 1eb58cd9138051ac413b386d50175cfebc97cde0 Mon Sep 17 00:00:00 2001
From: kaw67872 <kawtar.laariche@iais.fraunhofer.de>
Date: Sun, 6 Apr 2025 17:26:45 +0200
Subject: [PATCH] feat: support hosting Angular frontend under /v2 path

---
 Dockerfile |  2 +-
 nginx.conf | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index e8c0bf5..d24200c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,7 +14,7 @@ RUN npm install
 COPY . .
 
 # Build the Angular app
-RUN npm run ng build --configuration=prod
+RUN npx ng build --base-href=/v2/ --configuration=prod
 
 #RUN npm run ng -- build --configuration=dev02
 
diff --git a/nginx.conf b/nginx.conf
index a40436b..5617e04 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,15 +1,14 @@
 server {
     listen 80;
-
     server_name localhost;
 
     root /usr/share/nginx/html;
-    index index.html;
 
-    location / {
-        # Angular routing fallback
-        try_files $uri /index.html;
+    location /v2/ {
+        alias /usr/share/nginx/html/;
+        index index.html;
+        try_files $uri $uri/ /index.html;
     }
 
-    error_page 404 /index.html;
+    error_page 404 /v2/index.html;
 }
-- 
GitLab