Dynamic Routing Issues and Solutions
Campaign Studio Node-RED Routing Problem
When accessing tenant campaign studio URLs like https://tenant3.expertflow.com/campaign-studio/, the system was returning HTML content from the unified admin service instead of loading the Node-RED editor interface. Users would see a basic HTML page structure but the actual Node-RED components wouldn't initialize properly.
Root Cause Analysis
The issue was caused by conflicting APISIX routes in the Kubernetes cluster:
-
Primary Issue: A route called
dynamic-multitenant-campaigns-routewas intercepting all/campaign-studio*requests and sending them to the unified admin service instead of the nginx router that handles Node-RED routing. -
Secondary Issue: The correct route
campaigns-passthrough-to-router-routehad an invalid CORS configuration that prevented APISIX from properly applying the route. The route status showed "ResourceSyncAborted" which meant it was never actually active. -
Asset Loading Issue: Even when the main page loaded, JavaScript and CSS assets were not being served correctly due to path mapping problems in the nginx configuration.
Solution Steps
Step 1: Remove Conflicting Route
The dynamic-multitenant-campaigns-route was deleted from the expertflow namespace since it was routing campaign studio requests to the wrong service.
kubectl delete apisixroute dynamic-multitenant-campaigns-route -n expertflow
Step 2: Fix APISIX Route Configuration
Updated the campaigns-passthrough-to-router-route to remove the problematic CORS configuration:
-
Removed the invalid
allow_origins: $http_originsetting -
Increased route priority from 1 to 10 to ensure proper precedence
-
Route now successfully syncs and routes traffic to the nginx router service
Step 3: Update Nginx Configuration
Modified the nginx router configuration in the nginx-tenant-router-config ConfigMap to properly handle asset requests:
Before:
proxy_pass http://$backend_host:1880/red;
After:
rewrite ^/campaign-studio/(.*)$ /red/$1 break;
rewrite ^/campaign-studio/?$ /red/ break;
proxy_pass http://$backend_host:1880;
proxy_redirect off;
This change ensures that:
-
/campaign-studio/maps to/red/on the Node-RED service -
Static assets like
/campaign-studio/red/style.cssproperly map to/red/red/style.css -
All content types are served correctly (JavaScript as
application/javascript, CSS astext/css)
Verification
After applying the fixes:
-
Main Node-RED page loads with proper
<title>Node-RED</title> -
JavaScript assets return correct content-type headers
-
CSS assets load properly
-
Node-RED editor interface initializes completely
Notes
This issue typically occurs when multiple APISIX routes have overlapping path patterns with the same priority. Always check route status using kubectl describe apisixroute to ensure routes are properly synced before troubleshooting application-level issues.