This configuration is intended to send people to Node unless it's a .gif, .jpg etc., but it doesn't seem to work (it always sends them to Nginx):
frontend all 0.0.0.0:80 timeout client 86400000 # ... unless they're on websockets, which Nginx can't handle acl is_websocket hdr(Upgrade) -i WebSocket acl is_websocket hdr_beg(Host) -i ws # static assets acl url_static path_end .jpg .jpeg .gif .png .ico .pdf .js .css .flv .swf acl is_domain hdr_end(host) -i SUB.DOMAIN.com # ... or are using Socket.io, which is served by node acl is_websocket path_beg /socket.io # conditional for hitting node use_backend node_backend if !url_static is_domain use_backend nginx_backend if url_static # always send people to nginx default_backend nginx_backend
This is haproxy 1.4.
Edit: I should point out I'm serving static assets off the same domain as the Node.js stuff, but via Nginx. So the hostname is the same in both cases, I just want to forward requests for static assets to Nginx instead.