I am using Apache 2.4.6
I wanted to check if a custom header X-CUSTOM-HEADER is present in the request, if yes then set the same header and same value to the response. If the header is not present in the request then set the response header with a random value.
I am not able to read and set the same value from request Header to response header.
#******* THIS CODE DOES NOT WORK ********
Header set X-CUSTOM-HEADER %{req:X-CUSTOM-HEADER}e "expr=%{req:X-CUSTOM-HEADER} != ''"
I have also tried 'SetEnv' and 'Define' to read and set the header value to a variable and then use the variable while setting the response header, but that also did not worked.
In case the header is not presetn, I am using the mmod_unique_id module to set unique value.
****** THIS CODE WORKS *******
Header set X-CUSTOM-HEADER %{UNIQUE_ID}e "expr=%{req:X-CUSTOM-HEADER} == ''"