# Passing environment variables to Apache doesn't work

## thermoman

Hi,

i'm running several webservers behind a loadbalancer which keeps track of sending visitors to the same webserver as they request page after page.

For debugging purposes i want all these webservers to send a special Response-Header with their host name as value.

E.g: X-Served-By: www27

With older baselayout i could modify the /etc/init.d/apache2 script from

```
env -i PATH=$PATH start-stop-daemon ...
```

to

```
env -i PATH=$PATH HOSTNAME=$HOSTNAME start-stop-daemon ...
```

and then could do the magic in httpd.conf:

```
PassEnv HOSTNAME

Header always set X-Served-By %{HOSTNAME}e
```

Now with current packages of baselayout and apache2 this doesn't work anymore. The only response Header i get is

```
X-Served-By: (null)
```

When starting apache it tells me

```
PassEnv variable HOSTNAME was undefined
```

Calling the Init-Script via

```
HOSTNAME=foobar /etc/init.d/apache2 start
```

doesn't work, neighter does editing the /etc/init.d/apache2 script and put this inside.

How am i supposed to pass environment variables from the running shell to the apache process?

Got a tip? Post your thought here.

Thanks,

Marcel.

----------

## UberLord

In /etc/conf.d/apache2

export HOSTNAME=$(hostname)

----------

## thermoman

Hi Uber,

thanks, it works!

----------

