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/zhaoyangjian724/p/6199315.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值