haproxy path_end不能忽略

C:>ping www.zjtest7.com

正在 Ping www.zjtest7.com [192.168.32.82] 具有 32 字节的数据:
来自 192.168.32.82 的回复: 字节=32 时间<1ms TTL=63
来自 192.168.32.82 的回复: 字节=32 时间<1ms TTL=63




api 测试:

http://192.168.32.215:8082/api/

  <Valve className="org.apache.catalina.valves.RemoteIpValve"  remoteIpHeader="x-forwarded-for"/>
		<Context docBase="/t/deploy/zjtest/deployedApps/zjzc-web-api" path="/api" reloadable="false"/>
	

v-test-app01:/t/deploy/zjtest/deployedApps/zjzc-web-api> cd /t/deploy/zjtest/deployedApps/zjzc-web-api
v-test-app01:/t/deploy/zjtest/deployedApps/zjzc-web-api> ls
index.html  META-INF  WEB-INF

zjtest7-haproxy:/etc/haproxy# curl http://www.zjtest7.com | wc -l
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 31231  100 31231    0     0  6672k      0 --:--:-- --:--:-- --:--:-- 14.8M
638


zjtest7-haproxy:/etc/haproxy# curl http://www.zjtest7.com/api/
test 8082 2016-08-25:09:39

此时都正常:

/*****************
frontend web_service
	bind	*:80
        acl             zjdev_6_req             hdr_beg(host)           -i                           www.zjtest7.com
        #acl             url_static_zjdev        path_end                                            .html .gif .png .jpg .css .js 注释掉这行
        use_backend     webserver_8001          if                      zjdev_6_req          
      default_backend webserver_8001
     
     	acl 		api_req    		path_beg    		-i 			/api
	use_backend 	appserver_8082 		if	    		api_req


       backend	webserver_8001
	mode    	http
	balance		roundrobin
	server  	webhost01_8001		192.168.32.213:8001     check inter 2000 fall 3 weight 20
	#server  	webhost02_8001		192.168.32.214:8001     check inter 2000 fall 3 weight 20

     backend appserver_8082
        mode            http
        balance         roundrobin
        server          apphost01_8082          192.168.32.215:8082      check inter 2000 fall 3
	

此时请求 	:
zjtest7-haproxy:/etc/haproxy# curl http://www.zjtest7.com/api/
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.7.7</center>
</body>
</html>

找不到页面,
		
请求日志:
2016-08-25T10:05:23+08:00 localhost haproxy[18722]: 192.168.33.29:60348 [25/Aug/2016:10:05:23.508] 

web_service webserver_8001/webhost01_8001 1/0/0/1/2 404 317 - - ---- 0/0/0/0/0 0/0 "GET /api HTTP/1.1"
	
	
	
用/api去请求webserver_8001 显然请求不到

原文地址:https://www.cnblogs.com/hzcya1995/p/13350364.html