Hello,

I'm trying to configure haproxy to route static urls to Apache, and dynamic
(api-rpc) requests straight to Tomcat.

The config looks like:

backend static
       mode http
       option forwardfor
       balance roundrobin
       server apache:http localhost:8888 check inter 2000 rise 2 fall 5

backend api
       mode http
       option forwardfor
       balance roundrobin
       server tomcat:http localhost:8080 check inter 2000 rise 2 fall 5

frontend web *:80
        acl URL_API path_beg /api
        use_backend api if URL_API
        use_backend static if ! URL_API

e.g. any incoming request starting with /api should go to Tomcat, listening
on port 8080. Everything else goes to Apache, listening on port 8888.

It seems as though both backends are being used, because when i hit /
sometimes I will get index.html served by Apache, other times I will get the
"welcome to Tomcat" page.

What's wrong with this config?

Thanks,
Brian

Reply via email to