Welcome! Log In Create A New Profile

Advanced

Variable “set” in map with an Header Value was lost when we delete the header.

January 12, 2022 12:44PM
Hello,

We have an responseHeader with technical information sent by the upstream server tomcat.
We want to log this information in nginx and delete the header to avoid to be visible in the response Header to the client.

log_format formatjson escape=json '{
'"tomcat_container_id": "$TOMCAT_CONTAINER_ID" }';

Nginx.conf in http {
map $sent_http_Container_Id $TOMCAT_CONTAINER_ID {
default $sent_http_Container_Id;
}
more_clear_headers 'Container-Id';

When I do this, my log tomcat_container_id is empty.
If I comment the more_clear_header command line, I have my log fill with the right value but the header is also sent to the client.
So I don’t understand why my $TOMCAT_CONTAINER_ID Is clear when I delete the header and not clear if I don’t.

Thanks for your help.
Subject Author Posted

Variable “set” in map with an Header Value was lost when we delete the header.

podzol33 January 12, 2022 12:44PM

RE: Variable “set” in map with an Header Value was lost when we delete the header.

Reinis Rozitis January 12, 2022 01:30PM

Re: Variable “set” in map with an Header Value was lost when we delete the header.

Maxim Dounin January 12, 2022 01:38PM

Re: Variable “set” in map with an Header Value was lost when we delete the header.

podzol33 January 14, 2022 10:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready