0

I want to use GZIP encoding to my site and how should . I set the content encoding of my html file to gzip.

T tried like this

<html lang="en" pageEncoding="gzip">

I am using Apache Tomcat web server.

6
  • Are you using Apache Tomcat or Apache HTTPD? Commented Oct 12, 2012 at 15:18
  • 2
    viralpatel.net/blogs/enable-gzip-compression-in-tomcat Commented Oct 12, 2012 at 15:19
  • Is this HTML file an HTML file or the HTML output of a script? Commented Oct 12, 2012 at 15:19
  • @Quentin It is html file only Commented Oct 12, 2012 at 15:21
  • i tried like this — Where did you put that code? Commented Oct 12, 2012 at 15:25

2 Answers 2

1

You have confused content encoding (gzip, deflate) with page (aka character) encoding (ISO-8859-1, UTF-8, etc.).

In order to enable gzip compression on Apache Tomcat, you have to do it at the <Connector> level -- and only HTTP connectors are supported. See the compressableMimeType, compression, and compressionMinSize attributes for <Connector> in the Apache Tomcat HTTP Connector Configuration Reference

Sign up to request clarification or add additional context in comments.

Comments

0

Content compression is handled by the web server at the HTTP protocol layer. There are hints you can put in content itself to have the web server do things like this, but it's dependent on your server and the content. You can configure your web server to compress static content or dynamic content and if you're using something like PHP you can even do compression in your PHP code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.