Is it possible to use Setoutputfilter DEFLATE without caching copy?

Asked

Viewed 92 times

2

I know that the SetOutputFilter DEFLATE has the function of compressing the file to be received by the browser. I used this in my . htaccess to reduce file load time data.js

<FilesMatch "^(dados)\.js$">
SetOutputFilter DEFLATE
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Expires "Fri, 22 Aug 1980 22:08:00 GMT"
</FilesMatch>

The first part works the file is sent to the fastest browser ever on header set cache-control no-cache is ignored.

  • A doubt, I did not understand "decrease the time", when you disable the cache actually the loading time is longer because you will have to download the file again instead of using Cache, you want to reduce the time or want to avoid Cache?

  • @Guilhermenascimento I want to avoid the cache, only that I added Setoutputfilter DEFLATE to stay 100/100 in Pagespeed Insights worked by half in some browsers the cache is not stored already in others a copy is sent. So as in life everything is a matter of choice left without the Setoutputfilter DEFLATE .

  • I understand you refer to the Deflate to compress the answer, yet this will only reduce the size of the answer, does not mean it will be faster. Anyway I’ll test, really IE has some problems with the Headers.

1 answer

0

Yes it is possible and it is exactly the way you did. How did you test it? using exactly your rules in mine. htaccess the copy lock in the cache works perfectly.

Just look at the result using the code you provided in the question:

inserir a descrição da imagem aqui

The rules of Cache-Control are there in the headers exactly as defined in . htaccess, and the returned Status Code is always 200 OK, no matter how many reloads on the page I do, which indicates that the file is always being served from the server (you would receive a 304 in case of local cache).

As extra you can take a look here 100% cache prevention for files, however the only additional rule shown is the Pragma Header set Pragma "no-cache" that is already something obscene to a long time and in practice should not change anything.

  • Actually Header set Pragma "no-cache has not been used for a long time and does not pass W3C validation so I removed that line from the rules. I tested on IE6 that it is also obsolete and a copy was there... I need 100% cache prevention using Setoutputfilter DEFLATE. htaccess rules work perfectly if I remove the Setoutputfilter DEFLATE line but my file takes time to load...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.