Reputation: 131
I'm running a VirtualBox server with CentOS 5.8 installed to develop a new Admin interface for a customer that wants the backend to use a 1366px x 768px fixed width layout instead of the existing 1024px x 768px.
httpd server is 'stock' Apache/2.2.3 as supplied as part of CentOS 5.8
php is 'stock' PHP 5.3.3 as supplied as part of CentOS 5.8
Much of the work is making changes to the css files to utilise the extra width as it's all about layout for the client.
The problem is that somewhere files are getting cached and I'm not seeing the changes that I make to the css files. Shift F5 and Ctrl F5 make no difference on the client browsers.
This is driving me crazy and taking far too long to resolve, so I'm posting as a cry for help. I've tried a number of supposed 'solutions' regarding .htaccess tweaks and adding parameters to the link css file but all to no avail
I feel that it's an httpd issue, but many so called 'experts' all insist it's a browser issue. I have tested in MS Exploder, Opera, Chrome and Opera Mobile Emulator and am not seeing the css changes instantly in any.
I hope that someone can help as this MUST be frustrating other developers.
How is it possible to disable ALL caching on the VirtualBox CentOS environment and Firefox v17?
Upvotes: 0
Views: 530
Reputation: 21
I had the same issue. I found resolution here:
http://www.danhart.co.uk/blog/vagrant-virtualbox-modified-files-not-updating-via-nginx-apache
problem is that VirtualBox’s Shared Folders do not fully support sendfile()
so yu have to turn it off in your apache / nginx config file:
apache: EnableSendfile off
nginx: sendfile off;
it worked for me
Upvotes: 2
Reputation: 131
Thanks.
It's not a router or an ISP issue as the server is simply hosted in a VirtualBox container with the Document Root pointing to mounted Shared Folders.
I'm using this approach as I have to support a few different websites and some of the hosts are running php v5.2 and others are on v5.3. It also means that I can easily check for issues regarding deprecated functions.
I tried using the addon query string to the stylesheet name, however a 'View Source' showed the new name yet the content was still the 'old' sheet.
It's not a browser issue, as Chrome, IE and Firefox are all displaying the same issue, so it's definately the Apache Server.
There is no server side software installed it's a simple 'yum install httpd*' from the CentOS 5.8 DVD.
I've got round the issue of the cached css by creating work-in-progress.php and having the following at the top of the file :
<?php
header("Content-type: text/css; charset: UTF-8");
?>
I then load the stylesheet as the last item in the <head> using the .php extension.
<link rel='stylesheet' type='text/css' href='work-in-progress.php'>
It's a bit tacky, but at least it works for the css
I still need to resolve what parameter to change in the Apache config as images are also being cached and unless I change the filename each time I modify a background image, I still get served with the 'old' image.
I've tried just doing a service httpd restart after making a change, but this doesn't seem to have any affect.
Upvotes: 0
Reputation: 14222
Caching can occur at many levels: the server, the browser, or in between (proxies, your ISP, your router, etc).
Do you have any server-side caching software installed? Varnish, Pagespeed, or anything similar?
You can break caching by adding a variable URL query string to the filenames -- eg load mystyle.css?r=34234235
instead of just mystyle.css
. Changing the number will cause force it to reload as a fresh URL without a cache, regardless of where the caching is being done.
To answer your question directly: In Firefox, you can definitively clear the cache by opening the Options window, Advanced options, Network tab. There's a "Clear Cache" button here. This should solve the problem for you if it's a browser caching issue. There's also a feature here to manage the cache size. Set this to zero to prevent firefox caching anything (but be prepared for it to load pages a lot slower).
Upvotes: 0