我想在 Nginx 中添加远程 ip 作为 Cookie,以便它可以传递给 AWS 负载均衡器以获得负载均衡器的粘性。
location / {
proxy_set_header Cookie "$http_cookie; ip=$remote_addr";
proxy_pass http://app_upstream;
}
Run Code Online (Sandbox Code Playgroud)
我使用这些来设置 cookie,但 AWS ELB 不接受它作为粘性。由于此服务器用作 iframe,因此我无法使用 ELB 生成的 cookie 进行负载平衡,以防 Safari/iOs 默认阻止 3rd 方 cookie。
我愿意放弃 nginx 并编写自定义反向代理。