2

On my live server my versioned content (the url containing the versioned number) is not returning the static files compressed. However when I check the literal path to the content, by removing the “versionXXXXXX” from the url and resending the request, the content is being compressed and returned as so to the browser. I have my htaccess file in pub/static that does the rewrite properly. Can anyone help me out as to why the versioned url is not returning the compressed content to the browser?

On my local server, the versioned content is being gzipped properly. Accept-Encoding headers are being read properly and in turn returning the compressed content to the browser. But this is not the case on my live server.

8
  • You can disable if from admin for now: Stores > Configuration > Advanced > Developer > Sign Static Files > No and enable it again once the issue resolved. The above path would be shown if you are running with developer mode. In case production mode you can run below query to disable it :- insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0); Sep 22, 2018 at 10:32
  • @HimmatPaliwal i know about the admin panel option. So to clarify, that path with the version number is only supposed to show in developer mode??? I’m in production mode, so is this wrong behavior? Is that query for the core_config_data table. The odd thing is my local server is working ok and gzipping content even with the versioning enabled and version number included in the url. Why?
    – Jason
    Sep 22, 2018 at 12:13
  • Yes, this option is visible in developer mode only. There are few more settings which are only shown in developer mode. It would be great if you ask hosting team to check with gzip issue at server. It might be some server settings related issue. Sep 24, 2018 at 5:19
  • @HimmatPaliwal i have been asking hosting team. They keep saying it’s problem with my htaccess. I don’t think it’s a problem with my file. And this option is actually always available I think. But it only works in production mode.
    – Jason
    Sep 24, 2018 at 5:21
  • Oh I see, which version of Magento you are using and is it Nginx server or apache? Sep 24, 2018 at 5:32

1 Answer 1

0

After days of debugging it turns out that on my live server, the RequestHeader for Set-Encoding was being stripped in the RewriteRule for static versioning, or was simply not being passed along. This was not happening on my Apache setup on my local machine. My web host still has not give me an explanation why this was happening, nor do I know if it has to do with the htaccess file in the pub/static directory, but adding the RequestHeader set below (which is NOT in the Magento-supplied htaccess file):

<IfModule mod_headers.c>

#THE LINE BELOW THIS COMMENT
RequestHeader set Accept-Encoding "gzip, deflate, br"  

to the htaccess file in pub/static of my magento site fixed the issue with the compression.

If this is a server issue, I would like someone to comment below on what I might bring up with my webhost to address this. Otherwise, I'm going to submit an issue to the Magento github.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.