直接打印Cookie出來(lái),首頁(yè)和其他請(qǐng)求,沒(méi)有區(qū)別我的Nginx配置文件 set $uid "-";
if ( $http_cookie ~* "uid=(\S+)(;.*|$)"){
set $uid $1;
}
log_format s_access '[$time_local] $remote_addr - "$request" - '
'$status - $body_bytes_sent - "$http_referer" - '
'"$http_user_agent" - $request_time - "$uid" "$http_cookie"';兩個(gè)Access Log,上邊一個(gè)是訪問(wèn) /list cookie 在最后一個(gè)""內(nèi),前一個(gè)""是空的,看樣子是if進(jìn)來(lái)了,但是uid是空的;下筆那一個(gè)是訪問(wèn) / cookie 和前一個(gè)一樣,在""內(nèi),前一個(gè)""有值,識(shí)別出來(lái)了。非常郁悶![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"
2 回答

小唯快跑啊
TA貢獻(xiàn)1863條經(jīng)驗(yàn) 獲得超2個(gè)贊
cookie是需要訪問(wèn)一次,然后再返回給客戶端的。
第一次訪問(wèn)客戶端沒(méi)有cookie
- 2 回答
- 0 關(guān)注
- 245 瀏覽
添加回答
舉報(bào)
0/150
提交
取消