0

I'm using mod_deflate to server gzip content for js and css files.

Using curl I can see that it works and I can see the code but Chrome still thinks it's gzip content and NOT stylesheets/javascript so it won't render them.

Chrome says: Resource interpreted as Stylesheet but transferred with MIME type application/x-gzip.

So I guess that's apache sending wrong headers. But I don't know how to fix it.

Anyone has an idea?

Server is running Ubuntu 12 64 bits, with apache2.

Thanks!

Tommy B.
  • 1,403
  • 2
  • 14
  • 14

1 Answers1

1

Your links are wrong.

You've made links to file.css.gz, which just serves the gzipped file directly.

Instead, you should link to file.css. The web browser will figure out that the gzipped file is there (nginx) and serve it, or will compress it itself.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • But why it used to work on http://vinpin.com for example? Thanks – Tommy B. May 17 '13 at 02:55
  • @Tom: It didn't work on `vinpin.com`. You had it configured to serve the gzipped files directly on `vinpin.com` and in instead served the regular files. That's an example of something *not* working. Computers are working when they do what you tell them to do. – David Schwartz May 17 '13 at 06:59
  • But how come it was working before? Now I configured nginx to automatically compress css and js. It seems to work for real now, basically once this is activated all I have to do is serve the files the way I served them before right? Thanks – Tommy B. May 17 '13 at 13:21
  • @Tom: It wasn't working before. It just happened that it was doing what you actually wanted it to do while it was broken and not doing what it was told to do. – David Schwartz May 22 '13 at 09:49