Skip to content

Instantly share code, notes, and snippets.

@jinuljt
Last active January 27, 2021 09:41
Show Gist options
  • Save jinuljt/3b2563141b91555e47ccbb1fec70d3e7 to your computer and use it in GitHub Desktop.
Save jinuljt/3b2563141b91555e47ccbb1fec70d3e7 to your computer and use it in GitHub Desktop.

HTTP自定义Header (HTTP user-defined header)

明道云私有化部署遇到的坑。它使用了一个自定义http header md_pss_id

根据nginx文档说明,自定义header默认不会传递给upstream。

By default, nginx does not pass the header fields “Date”, “Server”, “X-Pad”, and “X-Accel-...” from the response of a proxied server to a client. The proxy_hide_header directive sets additional fields that will not be passed. If, on the contrary, the passing of fields needs to be permitted, the proxy_pass_header directive can be used.

需要如下配置:

underscores_in_headers on;

location / {
  // other proxy config
  proxy_set_header md_pass_id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment