Question

I'm a newbie with haproxy and I'm trying to figure out how to do something which seems quite simple. I want to proxy a tomcat context.

For example http://bobsautomotive.com:8080/HelloWorld

Here is my haproxy config:

 global
    daemon
    maxconn 256
    log 127.0.0.1 local0

defaults
    mode http
    option httplog
    option logasap
    log global

    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http-in
    bind *:80
    default_backend servers

backend servers
    balance roundrobin
    option redispatch
    option httpclose
    option forwardfor
    cookie JSESSIONID prefix
    server one tomcat.bobsautomotive.com:8009 cookie tomcat1 check
    stats uri /admin?stats
    stats realm haproxy
    stats scope .

This works fine to get to the Tomcat main page. But, If I try to change it to use a context like:

server one tomcat.bobsautomotive.com:8009/han cookie tomcat1 check

It won't work...

Any ideas? Thanks

Was it helpful?

Solution

No one answered this question, but the answer lies in setting up a default host in tomcat server.xml

<Engine defaultHost="spaceman" jvmRoute="s1" name="Catalina> 
<Host appBase="webapps" name="spaceman">
  <Context docBase="quoteEngine" path="" reloadable="false" source="org.eclipse.jst.jee.server:spaceman"/>
   <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." resolveHosts="false" suffix=".txt"/>
  </Host>
</Engine>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top