From a0b0db5ec8d165208e3c0f943c46429fbca61514 Mon Sep 17 00:00:00 2001 From: dahoud Date: Thu, 23 Oct 2025 11:57:24 +0000 Subject: [PATCH] Fix: Configure quarkus.http.root-path for proper Swagger UI routing - Added quarkus.http.root-path=/btpxpress in production config - Removed custom Swagger UI files (index.html, swagger-initializer.js) - Backend now knows it's served under /btpxpress context path - Swagger UI will correctly generate URLs like /btpxpress/openapi IMPORTANT: Ingress configuration must be updated to NOT use rewrite-target The Ingress should pass requests to backend with full path preserved: https://api.lions.dev/btpxpress/openapi -> http://backend:8080/btpxpress/openapi This is the proper solution instead of using rewrite-target which breaks context-aware applications like Swagger UI. --- .../resources/swagger-ui/swagger-initializer.js | 15 --------------- src/main/resources/application-prod.properties | 4 +++- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 src/main/resources/META-INF/resources/swagger-ui/swagger-initializer.js diff --git a/src/main/resources/META-INF/resources/swagger-ui/swagger-initializer.js b/src/main/resources/META-INF/resources/swagger-ui/swagger-initializer.js deleted file mode 100644 index 6835b91..0000000 --- a/src/main/resources/META-INF/resources/swagger-ui/swagger-initializer.js +++ /dev/null @@ -1,15 +0,0 @@ -window.onload = function() { - window.ui = SwaggerUIBundle({ - url: "/btpxpress/openapi", - dom_id: '#swagger-ui', - deepLinking: true, - presets: [ - SwaggerUIBundle.presets.apis, - SwaggerUIStandalonePreset - ], - plugins: [ - SwaggerUIBundle.plugins.DownloadUrl - ], - layout: "StandaloneLayout" - }); -}; diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 32b3d90..0e6d214 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -19,7 +19,9 @@ quarkus.hibernate-orm.log.bind-parameters=false # Serveur HTTP quarkus.http.port=${SERVER_PORT:8080} quarkus.http.host=0.0.0.0 -# Note: root-path removed - Ingress handles /btpxpress routing with rewrite-target +quarkus.http.root-path=/btpxpress +# Note: Backend is aware of the /btpxpress context path +# Ingress should NOT use rewrite-target to preserve the full path # CORS Configuration pour production quarkus.http.cors=true