非常郁闷,访问首页的请求,可以从cookie里把uid分析出来,但是其他的请求全不行。
直接打印Cookie出来,首页和其他请求,没有区别
我的Nginx配置文件
set $uid "-"; if ( $http_cookie ~* "uid=(\S+)(;.*|$)"){ set $uid ; } log_format s_access '[$time_local] $remote_addr - "$request" - ' '$status - $body_bytes_sent - "$http_referer" - ' '"$http_user_agent" - $request_time - "$uid" "$http_cookie"';
两个Access Log,上边一个是访问 /list cookie 在最后一个""内,前一个""是空的,看样子是if进来了,但是uid是空的;下笔那一个是访问 / cookie 和前一个一样,在""内,前一个""有值,识别出来了。
非常郁闷!
[04/Dec/2012:21:44:43 +0800] 145.122.142.124 - "GET /list HTTP/1.1" - 200 - 18573 - "-" - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.60 Safari/537.11" - 0.079 - "" "__c_uactiveat=1350108823468; __c_review=46; __c_last=1351061042906; __c_visitor=1350104003730701; uid=103; __utma=224849432.425128387.1339588739.1354606821.1354625898.809; __utmb=224849432.12.10.1354625898; __utmc=224849432; __utmz=224849432.1354108162.783.24.utmcsr=e.weibo.com|utmccn=(referral)|utmcmd=referral|utmcct=/2036070420/z7ixpvGv4; sess=50b8f.796" [04/Dec/2012:21:45:18 +0800] 145.122.142.124 - "GET / HTTP/1.1" - 200 - 13449 - "-" - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.60 Safari/537.11" - 0.248 - "1030000000091320" "__c_uactiveat=1350108823468; __c_review=46; __c_last=1351061042906; __c_visitor=1350104003730701; uid=103; __utma=224849432.425128387.1339588739.1354606821.1354625898.809; __utmb=224849432.13.10.1354625898; __utmc=224849432; __utmz=224849432.1354108162.783.24.utmcsr=e.weibo.com|utmccn=(referral)|utmcmd=referral|utmcct=/2036070420/z7ixpvGv4; sess=50b8f.796"
$cookie_xxx xxx就是cookie的key
cookie是需要访问一次,然后再返回给客户端的。
第一次访问客户端没有cookie