I have a Node app running with ExpressJS, Next and React and this app loads dynamically different layouts based on a header it receives. This header is set by Nginx in the virtualhost. So imagine 3 different domains which has to load this same app, but each virtualhost has a different value in this header, so this is what the app reads and returns the right layout.
This approach works as expected until 2 requests with different value in this header arrives at the same time. When that happens, the response from one of them could be overlapped with the other completely or partially some times.
I am aware of the functionality of app.local and request.local which works to isolate request/response but after playing with it, it doesn't fix my problem, or maybe I am using it the wrong way.
At this link you can see the software architecture concept of the app (simplified). If you want to reproduce the error, you would have to set up 2 virtualhosts with this header with different value and load both domains at once:
https://codesandbox.io/s/zmoq4q3mp
Any help would be appreciate.
Thank you so much.
from Erratic behaviour in response express + next + react with concurrent requests
No comments:
Post a Comment