I was trying to enable gzip compression in apache with the help from the link http://httpd.apache.org/docs/2.0/mod/mod_deflate.html.
The apache I had was compiled from source. So I had to recompile Apache with the extra configuration parameter "--enable-deflate".
After modifying the httpd.conf as mentioned in the above link, I restarted Apache and got this error - "Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration". When I commented the line "Header append Vary User-Agent env=!dont-vary" and restarted Apache, it worked. The gzip compression in Apache worked fine.
But I wanted to enable "Header append Vary User-Agent env=!dont-vary" because that would make sure that proxies don't deliver the wrong content.
The error message "Invalid command 'Header'" appeared because the Apache module mod_headers was not enabled. To enable mod_headers, I had to recompile Apache with the configuration parameter "--enable-headers".
If you installed Apache from a build, then you will have to add the line
LoadModule headers_module modules/mod_headers.so
in httpd.conf.
The list of configuration parameters can be seen at http://httpd.apache.org/docs/2.0/programs/configure.html.
Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration
Tuesday, February 3, 2009
Posted by Dandy at 5:37 AM 0 comments
Labels: Apache, gzip, mod_headers
IE changes docx, xlsx, pptx to zip while downloading
Wednesday, January 21, 2009
Microsoft Office 2007 has introduced some new file formats like docx, xlsx, pptx etc. One docx/xlsx/pptx file is actually a collection of many files, stored in an archive (zip-file).
When these files are downloaded by the Internet Explorer from a webserver, the extension of the file may be changed to "zip". (To open this file, you just need to change the extension to the correct one)
This problem can be fixed at the webserver level by adding the MIME type of the new extensions.
For Tomcat, add the MIME types in the conf/web.xml file, as given below.
<mime-mapping>
<extension>docx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xlsx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
</mime-mapping>
<mime-mapping>
<extension>pptx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.presentationml.presentation</mime-type>
</mime-mapping>
For Apache, add the MIME types in the conf/httpd.conf file, as given below -
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
Posted by Dandy at 12:10 AM 0 comments
Labels: Apache, MS Office 2007, Tomcat, zip