I have a new VPS Host and have cloned my existing live site from my current VPS Host. On the new host, there is an issue with JS aggregation and I am hoping someone might recognize what this is and how to solve it.
Generally with JS aggregation set at
/sites/default/files/js/ and it seems fine, files are writing to this directory (both the JS files and the GZipped ones).
When I view the raw code of any of these files, the code is fine (not corrupt). I have also tried switching this off, clearing cache, switching back on, clearing browser cache and even deleting the directory which Drupal did and then recreated without any issue. I checked my PHP info file (5.2.17) and it shows this under
_SERVER["HTTP_ACCEPT_ENCODING"] - gzip,deflate,sdch so that seems ok. However my old server's PHP info file also had
gzip,deflate,sdch under an additional heading called "
HTTP Headers Information".
But here is the real tell-tale, I think, when I view the code of my webpage with Chrome web inspector and look in Console, I see as many JS errors as there are aggregated files. (5 or 6 I think). The error is:
Uncaught SyntaxError: Unexpected token ILLEGAL If I then view the corresponding JS file, I see this:
So somehow, the aggregated JS files are turning into gibberish characters and the errors are thrown. I have spoken with my webhost and we tried some things but nothing worked. They had me put this code into .htaccess but it did not work:
[root@host ~]# httpd -L | grep deflate
Also I was not exactly sure where in .htaccess to put it. (under
<IfModule mod_headers.c> perhaps?) At any rate this did nothing to help matters no matter where I tried that code. I feel like this is a bit of a needle in a haystack and might be tricky to fix but I am curious if anyone recognizes what might be going on so i can fix it.
** I should also note that litespeed Server is running on top of this so not sure if there are nay issues with that. I have not looked into this yet.