一、现象:
162.250.132.4 - - [07/Jan/2017:04:21:45 +0000] "GET /cxf/spin/rest/wager?cost=40&sessionid=s-9cd4b47f-1c95-4f08-bf29-e536b9540a4a&playerid=6007409&cycleid=58706981d16c378605000152&actionid=58706981d16c378605000153 HTTP/1.1" 405 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
405 Method Not Allowed:请求方法(GET、POST、HEAD、DELETE、PUT、TRACE等)对指定的资源不适用。
根本原因是自己用curl测试的时候默认使用的是get方法,我们需要用post方法:
curl -d "birthyear=1905&press=OK"https://gs-staging.playcln.com/cxf/spin/rest/wager?cost=40&sessionid=s-9cd4b47f-1c95-4f08-bf29-e536b9540a4a&playerid=6007409&cycleid=58706981d16c378605000152&actionid=58706981d16c378605000153
162.250.132.4 - - [07/Jan/2017:04:21:53 +0000] "GET /cxf/spin/rest/getPlayer?token=s-b1d62458-a1a3-444a-84aa-4eb2ee6506cc HTTP/1.1" 404 47 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
为什么会出现404呢?就是因为请求没有获取到资源。这个由于自己的haproxy配置出错:
frontend main *:6443
#acl url_external path_beg -i /amayaGamePostService
acl url_external path_beg -i /cxf/spin/rest/
我们需要把/amayaGamePostService改成/cxf/spin/rest/
karaf简介:
二、haproxy 超时机制
- timeout http request :在客户端建立连接但不请求数据时,关闭客户端连接
- timeout queue :等待最大时长
- timeout connect: 定义haproxy将客户端请求转发至后端服务器所等待的超时时长
- timeout client:客户端非活动状态的超时时长
- timeout server:客户端与服务器端建立连接后,等待服务器端的超时时长,
- timeout http-keep-alive :定义保持连接的超时时长
- timeout check:健康状态监测时的超时时间,过短会误判,过长资源消耗
- client_timeout 是 app 连接 haproxy的时间
- server_timeout 是haproxy 连接后端的时间.
- 下面是我们自己的服务器配置:
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s注意:如果这里没有单位默认是毫秒
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000