Posts Tagged ‘Fix “Invalid command ‘Header’’

Fix “Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration” on Debian Squeeze Apache 2.2

Wednesday, May 12th, 2010

I am enabling http gzipping on Apache 2.2.9-10+lenny7 I included the following Apache directives in my /etc/apache2/apache2.conf

<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems…BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html

# Don’t compress images
SetEnvIfNoCase Request_URI
.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>

Then I tried restsarting the Apache Webserver:

debian-server:~# /etc/init.d/apache2 restart
Syntax error on line 56 of /etc/apache2/apache2.conf:

and I ended up with the following error:

Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration

A quick look through my Apache module configurations and consultation with Google shown I’m missing the mod_deflate module along my Apache server loaded modules.

To enable the module to resolve the error issue:

Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration all I did was:

debian-server:~# ln -sf /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/headers.load

Then I restarted the Apache:

debian-server:~# /etc/init.d/apache2 restart

Hooray now html content passed from the Apache webserver to the end users is transferred in a gzip format ! 🙂