我有一个用于split_clients的下一个虚拟测试配置:
split_clients "${cookie_landing}" $landing {
50% test;
* main;
}
server {
listen 80;
location / {
rewrite / /$landing;
}
location = /test/ {
internal;
proxy_pass http://test.domain.ru/;
}
location = /main/ {
internal;
return 200;
}
}
可以与
一起运行docker run -it -d -v test.conf:/etc/nginx/conf.d/default.conf -p 8080:80 --name nginx openresty/openresty:1.15.8.2-7-alpine
使用上述配置,所有内部位置均无效。
如果设置了cookie,则请求会传递到/main
,并显示以下错误:
rewrite or internal redirection cycle while processing "/main"
没有cookie,请求就通过301代码传递到localhost/test/
(没有端口)。
我的配置出了什么问题?预先感谢。