nginx+webpy+fastcgi cookies的临时处理办法
先上nginx配置文件
server {
listen 8080;
server_name localhost;
location ~ \.(js|css|png|gif|ico)$ {
root D:\Python\zhc_demo;}
location / {
include fastcgi_params;
fastcgi_param SCRIPT_NAME
"";
fastcgi_pass 127.0.0.1:9999;
}
}
web.py 以fastcgi模式运行在9999端口.可以写cookies,但读不了.下面是解决方法
代码
web.setcookie(
'name',name,
72000,path=
'/')
referer = web.ctx.env.get(
'HTTP_COOKIE')
url=
"\'"+
'/form?name='+re.findall(
r'name=(.*)',referer)[
0]+
"\'"
print url