Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i'm trying to set up a server structure for an application i'm building in Node.js with

My setup is:

HAProxy frontend forward to

     -> apache2 as default backend (or nginx, is apache in this local test)

     -> node.js app if the url has in the request AND a domain name

i have something like:

    log   local0
    log   local1 notice
    maxconn 4096
    user haproxy
    group haproxy

    log     global
    mode    http
    maxconn 2000
    contimeout      5000
    clitimeout      50000
    srvtimeout      50000

frontend all
timeout client 5000
default_backend www_backend

acl is_soio url_dom(host) -i #if the request contains

acl is_chat hdr_dom(host) -i chaturl #if the request comes from

use_backend chat_backend if is_chat is_soio

backend www_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout server 5000
timeout connect 4000
server server1 localhost:6060 weight 1 maxconn 1024 check #forwards to apache2

backend chat_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout queue 50000
timeout server 50000
timeout connect 50000
server server1 localhost:5558 weight 1 maxconn 1024 check #forward to node.js app

The problem comes when i made a request to something like it load perfectly but fails to loads the files ( why it redirect to apache (and should redirect to the node.js app that serve the files). The weird thing is that if i access directly to the file, after refreshing a few times, it loads, so i suppose is "caching" the forwarding for the client when it makes the first request and reach the apache server.

Any suggestion of how this can be solved? or what i can try or look about this?

share|improve this question
HAProxy doesn't cache any content. I suspect the problem lies in the acl rule, where after "-i" – Sameer Nov 24 '12 at 4:14
any more details of how that is? i changed the rules to make it more straightforward, simpler, only checking for "" and not the server domain and i still see that if i make a request to the file first, and then i ask for like index.html, it redirects me to, after a few refresh it come back and loads the index.html from apache2 but them again, fails to load files :( – shadow_of__soul Nov 24 '12 at 12:08

1 Answer 1

up vote 1 down vote accepted

"option http-server-close" is missing from your configuration. Add it and your problems will go away.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.