nginx - 无法在 nginx 中设置多个 cookie
问题描述
我正在尝试在 NGINX 中设置多个 cookie,但没有合适的解决方案。任何人都可以帮我解决这个问题。我的代码如下:
if ($query_string ~ ([^&]*)cookie=([^&^:]*)){
add_header Set-Cookie "cookieName=test; Domain=.test.com; Max-Age=31536000;path=/";
}
如果请求 url 具有查询参数,则应设置此 cookie cookie=somevalue
。
解决方案
if ($arg_cookie = somevalue){
add_header Set-Cookie "name=value;max-age=3153600000;path=/";
}
推荐阅读
- javascript - 为什么useEffect不更新元素删除状态
- flutter - 在 Flutter 中使用 InAppWebview 未显示全部内容
- javascript - 如何从html将参数传递给打字稿函数?
- javascript - 多个包含在一个模型中查询
- python - 如何使用熊猫 convert_dtypes()?
- wordpress - 使用高级自定义字段中继器字段显示三列 Bootstrap 图像网格
- variables - 如何为 service_facts 声明一个变量
- c++ - 运行 NI-IMAQ 和 WINAPI 需要 2 个不同的子系统
- docker - 空手道:UI - Jenkins 集成
- java - 防止 Android One 设备中的屏幕捕获