1

I'm using Apache server and trying to add for each request, a response header, with a value of some environment variable. For example:

Header set MyHeader %{REQUEST_STATUS}

The above configuration adds the header with the value (null).

What is the correct way to do that?

odavid
  • 629
  • 1
  • 6
  • 17

1 Answers1

0

If you need it in an SSL context, you'd need to append s to the environment variable, like so:

Header always set X-The-Request "%{THE_REQUEST}s"

If you append e, it reads an environment variable.

See the note in the official docs:

The %s format specifier is only available in Apache 2.1 and later; it can be used instead of %e to avoid the overhead of enabling SSLOptions +StdEnvVars. If SSLOptions +StdEnvVars must be enabled anyway for some other reason, %e will be more efficient than %s.

Quoting Eddie
  • 1,501
  • 1
  • 11
  • 14