Security/Cache issue with my Hosting provider ?

SBSP

Senior Member
Joined
Sep 7, 2007
Messages
663
My hosting provider's apache server seems to cache stuff and no matter what I do I cant prevent it.

I made some changes to a page then realized the browser is not displaying the changes I made. After messing around a bit I tried visiting a link using chrome which I didnt have on my PC I had to first download it. Its as if It froze the content it last served. Same happens on edge and IE, I thought I had a caching proxy configured at some point in time but I didn't and the browser is not set to go via a proxy.

The last test I did was via my cellphone using my Vodacom internet as opposed to wifi via telkom adsl

Here's an example. I created the below file and made PHP return 'test', visited the page then changed it to output test1
http://www.techtinker.co.za/test.php

Please test it for me and let me know if you see test or test1 if you see test then Afrihost has a serious security issue.

Also some content only shows stuff from the mySQL database based on your login I.E Email address AFTER being authenticated. If someone visit the page directly without authenticating (From a different internet connection) the page is supposed to redirect to the index and login page. But instead its showing the "cached" version of the page as it was last displayed on my PC
 
Last edited:

SBSP

Senior Member
Joined
Sep 7, 2007
Messages
663
I just realized it takes about 10 mins for a change to affect.
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
Change your files with versions.

.css?v1db336cxs3bv4iz8swn

Etc

Sass is pretty sweet in this aspect
 

Johnatan56

Honorary Master
Joined
Aug 23, 2013
Messages
30,955
Change your files with versions.

.css?v1db336cxs3bv4iz8swn

Etc

Sass is pretty sweet in this aspect

Is there an addon that automatically updates your css using a timestamp, e.g. .css?v19095103152017
Would be easier to keep track of it.
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
Is there an addon that automatically updates your css using a timestamp, e.g. .css?v19095103152017
Would be easier to keep track of it.

Cheap and dirty:

PHP:
<link rel="stylesheet" type="text/css" href="style.css?<?php echo time(); ?>" />

PHP:
<?php $cssVersion = "3.4.2"; ?>

<link rel="stylesheet" href="style.css?v=<?php echo $cssVersion; ?>">

^Purely for cache busting
 

Johnatan56

Honorary Master
Joined
Aug 23, 2013
Messages
30,955
Cheap and dirty:

PHP:
<link rel="stylesheet" type="text/css" href="style.css?<?php echo time(); ?>" />

PHP:
<?php $cssVersion = "3.4.2"; ?>

<link rel="stylesheet" href="style.css?v=<?php echo $cssVersion; ?>">

^Purely for cache busting

Nice, hope that anyone finding this thread due to cache issues gives Thor a rep. :)
 

SBSP

Senior Member
Joined
Sep 7, 2007
Messages
663
Still wondering why it would share the same cache from 2 different browsers on 2 different internet connections.
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
Still wondering why it would share the same cache from 2 different browsers on 2 different internet connections.
Probably being send by the headers from apache or it can be the .htaccess file. So many things.
 

koeksGHT

Dealer
Joined
Aug 5, 2011
Messages
11,857
Do the php headers not work?

<?php
//set headers to NOT cache a page
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
header("Pragma: no-cache"); //HTTP 1.0
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

//or, if you DO want a file to cache, use:
header("Cache-Control: max-age=2592000"); //30days (60sec * 60min * 24hours * 30days)

?>

We use the timestamp for images aswell, .png?2351343412 to prevent caching
 
Top