Requests are making it to my app server, but not into node.js -- why?
Posted
by
Zane Claes
on Server Fault
See other posts from Server Fault
or by Zane Claes
Published on 2012-10-13T13:41:50Z
Indexed on
2012/10/13
15:41 UTC
Read the original article
Hit count: 256
node.js
I detailed in this question on StackOverflow how some random requests are not making it from the client to my Node.js app server, resulting in a gateway timeout. In summary, identical requests are, at random, not even making it far enough to trigger a console.log() in my first line of express middleware.
I need to narrow down the problem, though, to find out WHERE the traffic is being lost and it was suggested that I try a packet sniffer on my app servers. Here's my setup:
- 2x Load Balancers (m1.larges)
- 2x node.js servers (also m1.large)
Here's what's interesting/unusual: the node.js servers started as PHP servers with an Apache stack and continue to serve PHP files for my domain (streamified.me). However, I use a little httpd.conf magic on the app servers so that requests to api.streamified.me get routed over port 8888 to the node.js server:
RewriteCond %{HTTP_HOST} ^api.streamified.me
RewriteRule ^(.*) http://localhost:8888$1 [P]
So, the request hits the load balancer => goes to an app server => gets routed to port 8888 if it's intended for the API => gets handled by node.js
So, in the same httpd.conf file, I turned on RewriteLogLevel 5 and then created a simple PHP+CURL script on my localhost to hit my api.streamified.me with a random URL (which should cause node.js to trigger a simple "not found" response) until it resulted in a Gateway timeout. Here, you can see that it has happened -- and the rewrite log shows that the request was definitely received by the app server and forwarded to port 8888... but it was never received by node.js (or, at least, the first line of code in the first line of middleware never gets it...)
Image Link: http://i.stack.imgur.com/3OQxS.png
© Server Fault or respective owner