« Back to Index

Debugging nginx with custom headers

View original Gist on GitHub

Debugging nginx with custom headers.conf

map "$http_x_some_custom_header" $foo {
  default 0;   # default value
  "desktop" 1; # if header is "desktop" then set $foo to 1
}

# or maybe some variable created via `set` declaration
# `set $foo bar;`

add_header X-debug-message "foo is ${foo}" always; # always only available from 1.7.5 nginx