Content rule matching and routing issue with two different ports on same server ??

0

Hello,

We have a React JS frontend application running on port: 5000 (serving static web content) and Node JS Express server running on port 3001 (serving API requests) on the same machine. The issue that we faced earlier, the code structure and the fix followed is almost matching to below similar post. React & Express server not getting api requests in production /build

However, the resolution mentioned in the above post only partially solves our issue. Though we can render and jump to the next page, but the API is not returning any data and it’s simply serving us the index.html file. We’ve observed that it works fine when running it locally or directly hitting the server’s IP over HTTP.

Also, when going over secured HTTPS/SSL domain name via a load balancer – it sometimes randomly renders the second page after first login page+API is hit and also serves the API requests with actual data, but sometimes it return API data only after jumping over from multiple pages or after multiple clicks and coming back to the original page shows the data. Another observation is that when the network bandwidth is slow i.e. when it takes time to render/load the page – it gets the data 80% of the time returned from API request.

We could see from logs that it did hit the API requests as 200 OK, but the content served was index.html, randomly sometimes.

So, we are suspecting that the issue might be due to content rule matching & their precedence setup on our Kemp’s load balancer (in the same below shown order where www.zzzzz.com/api/ are matched first) that routes the requests on different ports on same machine/server like below:

We have one Virtual Load Master Service listening on port:443 (HTTPS) where these ports are configured.

• Scheduling method: source IP hash

• WAF & SSL termination – enabled

 

Virtual IP

protocol

Layer

Real Server

Content Rule Regx Pattern & Precedence

Order

10.x.x.x: 443

TCP

L7

10.x.x.x: 3001

/^/api*/

1

 

 

 

10.x.x.x: 5000

Header(Host): www.zzzzz.com

2

 

 

Note: - reversing the order didn’t work for us i.e. first matching the host domain name and then for /api/ folder.

Any lead or help would be really appreciated.

Thanks!

0 comments