I'm trying to map the BPM specific $WSSR header to the Host header in a nginx configuration and I continue to get "nginx: [emerg] unknown "wssn" variable " errors. How can I access this header value in a nginx configuration? Is there a way to escape the $ character?
Here is my current configuration to try to map the custom header and the host to a single value
map $http_\$wssn $x_host {
default $host;
"~." $http_\$wssn;
}
reloading my config with this map results in this error
# nginx -s reload
2019/08/12 18:37:42 [emerg] 25091#25091: unknown "wssn" variable
nginx: [emerg] unknown "wssn" variable
As per agentzh-nginx-tutorials, the solution is a bit tricky. Since there is no way to escape dollar sign in NGINX variables, you have to make it a variable.
Totally untested, but maybe:
geo $dollar {
default "$";
}
geo $foo {
default "http_${dollar}wssn";
}
map ${dollar}${foo} $x_host {
default $host;
"~." ${dollar}${foo};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With