Apache caching javascript assets?

我只是一个虾纸丫 提交于 2019-12-06 03:37:15

问题


Not so long ago I was having trouble with javascript assets. When I made changes to them they wouldn't take effect and the file would become invalid javascript (firebug throwing errors and warnings).

I noticed that my changes weren't appearing and special characters were being added to the end of the file. A bit more digging and I noticed that the special characters were exactly the number of characters of my edits.

Original code:

$(document).ready(function(){
     alert('what');
});

Adding a line, should looks like this:

$(document).ready(function(){
     alert('what');
     alert("what's going on?!);
});

Renders like this:

$(document).ready(function(){
     alert('what');
});��������������������������

When I researched I found that modifying apache config's /etc/httpd/conf/httpd.conf and commenting out EnableSendfile off fixed the issue.

However...

Now the issue has returned, but apache config hasn't changed.

Please help. My current work around is renaming the file, viewing the new file and naming it back; this annoys me tremendously.

I'm developing on a vagrant box, CentOS 6, PHP 5.3/apache 2 - the original solution can be found here: Shared folder in VirtualBox for Apache.

Unfortunately this no longer seems to work.


回答1:


Often when EnableSendfile On causes breakage, EnableMMAP causes similar issues. Try turning that off too. You mentioned that you're using CentOS in Vagrant but not the host OS. Is it Windows perchance?



来源:https://stackoverflow.com/questions/9826596/apache-caching-javascript-assets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!