MyBB Hacks

Full Version: Cache Fix and load issue?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello , I use them cloudflare + free SSL, and I want to add a mod to fix a cache, but passing time while redirections . Does anyone know how to do that work directly with https and port 443?:


function getCurPageURL() {
$pageURL = 'http';
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

function FixCacheAction(){
global $mybb;
if($mybb->input["rndtime"]=="" && $_SERVER['REQUEST_METHOD'] != 'POST'){
$url=getCurPageURL();
if(strpos($url,"?")===false)
$url=$url."?rndtime=".TIME_NOW.rand();
else
$url=$url."&rndtime=".TIME_NOW.rand();
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: ".$url);
exit(0);
}
}
Maybe check that you're sending no-cache headers instead of hacking around it?
Your method isn't guaranteed to work anyway, since the redirect response can be cached too.
Reference URL's