开发者

Configuring Haproxy with Tomcat to use context

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


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜