代码之家  ›  专栏  ›  技术社区  ›  Aaron Gibralter

nginx是否删除自定义请求头?

  •  1
  • Aaron Gibralter  · 技术社区  · 16 年前

    在nginx.conf中,我的服务器部分有这一行:

    log_format debug 'header: "$http_x_myapp" cookies: "$http_cookie"';
    

    如果我这样做

    curl -H "X_MYAPP:test" -H "COOKIE:yay" localhost
    

    我在我的访问日志中得到如下信息:

    header: "-" cookies: "yay"
    

    有人知道nginx为什么要丢弃x_myapp头吗?

    2 回复  |  直到 15 年前
        1
  •  1
  •   Aaron Gibralter    16 年前

    哎呀。。。我很笨。

    curl -H "X-MYAPP:test" -H "COOKIE:yay" localhost
    

    作品。。。愚蠢的下划线…

        2
  •  0
  •   Guss    15 年前

    发送曲奇的正确方法是 -b 选项:

    curl -b 'yay' http://localhost