trying to suppress zealous caching implemented by IE11 and FF32

if left unchecked it breaks features that rely on location-headers
like changing the locale or logging out.
This commit is contained in:
Sarjuuk
2014-09-17 20:17:53 +02:00
parent 28d5e38408
commit 35ba86d191
9 changed files with 27 additions and 19 deletions

View File

@@ -22,9 +22,9 @@ AddDefaultCharset utf8
RewriteEngine on
# Mapper-Helper: If you cant provide maps for all locales, redirect the browser
RewriteRule ^(.*/)static/images/wow/maps/(frfr|dede|eses|ruru)/(.*)$ $1static/images/wow/maps/enus/$3 [NC]
RewriteRule ^(.*/?)static/images/wow/maps/(frfr|dede|eses|ruru)/(.*)$ $1static/images/wow/maps/enus/$3 [NC]
# accept flattened urls | NYI - need more work :x
RewriteRule ^([a-z0-9\-]+)$ ?$1 [NC] # /items => ?items
RewriteRule ^([a-z0-9\-]+)=([^?&]*)$ ?$1=$2 [NC] # /items=4.1 => ?items=4.1
RewriteRule ^([a-z0-9\-]+)=([^?&]*)[&?](.*)$ ?$1=$2&$3 [NC] # /items=4.1?filter=sl=7 => ?items=4.1&filter=sl=7
# RewriteRule ^([a-z0-9\-]+)$ ?$1 [NC] # /items => ?items
# RewriteRule ^([a-z0-9\-]+)=([^?&]*)$ ?$1=$2 [NC] # /items=4.1 => ?items=4.1
# RewriteRule ^([a-z0-9\-]+)=([^?&]*)[&?](.*)$ ?$1=$2&$3 [NC] # /items=4.1?filter=sl=7 => ?items=4.1&filter=sl=7

View File

@@ -42,7 +42,7 @@ class AjaxHandler
return;
if ($_ = DB::Aowow()->selectRow('SELECT IFNULL(c2.id, c1.id) AS id, IFNULL(c2.type, c1.type) AS type, IFNULL(c2.typeId, c1.typeId) AS typeId FROM ?_comments c1 LEFT JOIN ?_comments c2 ON c1.replyTo = c2.id WHERE c1.id = ?d', $this->get['id']))
header('Location: ?'.Util::$typeStrings[$_['type']].'='.$_['typeId'].'#comments:id='.$_['id'].($_['id'] != $this->get['id'] ? ':reply='.$this->get['id'] : null));
header('Location: ?'.Util::$typeStrings[$_['type']].'='.$_['typeId'].'#comments:id='.$_['id'].($_['id'] != $this->get['id'] ? ':reply='.$this->get['id'] : null), true, 302);
}
/* responses
@@ -303,7 +303,7 @@ class AjaxHandler
}
}
header('Location: ?'.Util::$typeStrings[$this->get['type']].'='.$this->get['typeid'].'#comments');
header('Location: ?'.Util::$typeStrings[$this->get['type']].'='.$this->get['typeid'].'#comments', true, 302);
break;
case 'edit':
if ((!User::canComment() && !User::isInGroup(U_GROUP_MODERATOR)) || empty($this->get['id']) || empty($this->post['body']))
@@ -588,7 +588,7 @@ class AjaxHandler
User::setLocale($this->params[0]);
User::save();
header('Location: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '.'));
header('Location: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '.'), true, 302);
}
private function handleAccount()

View File

@@ -617,7 +617,7 @@ abstract class Filter
}
// do get request
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize());
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize(), true, 302);
}
// sanitize input and build sql
else if (!empty($_GET['filter']))

View File

@@ -38,7 +38,7 @@ class AccountPage extends GenericPage
$this->forwardToSignIn('account='.$pageParam);
// doesn't require auth && authed
else if (!$this->validCats[$pageParam][0] && User::$id)
header('Location: ?account'); // goto dashboard
header('Location: ?account', true, 302); // goto dashboard
}
}
@@ -60,7 +60,7 @@ class AccountPage extends GenericPage
$this->resetPass = false;
if ($this->createRecoverPass($nStep)) // location-header after final step
header('Location: ?account=signin');
header('Location: ?account=signin', true, 302);
$this->head = sprintf(Lang::$account['recoverPass'], $nStep);
break;
@@ -95,7 +95,7 @@ class AccountPage extends GenericPage
else
{
session_regenerate_id(true); // user status changed => regenerate id
header('Location: '.$this->getNext(true));
header('Location: '.$this->getNext(true), true, 302);
}
}
else if (!empty($_GET['token']) && ($_ = DB::Aowow()->selectCell('SELECT user FROM ?_account WHERE status IN (?a) AND token = ? AND statusTimer > UNIX_TIMESTAMP()', [ACC_STATUS_RECOVER_USER, ACC_STATUS_OK], $_GET['token'])))
@@ -136,7 +136,7 @@ class AccountPage extends GenericPage
case 'signout':
User::destroy();
default:
header('Location: '.$this->getNext(true));
header('Location: '.$this->getNext(true), true, 302);
break;
}
}

View File

@@ -37,7 +37,7 @@ class EventPage extends GenericPage
// redirect if associated with a holiday
if ($this->hId && $this->typeId != $this->hId)
header('Location: '.HOST_URL.'?event='.$this->hId);
header('Location: '.HOST_URL.'?event='.$this->hId, true, 302);
$this->name = $this->subject->getField('name', true);
}

View File

@@ -336,7 +336,7 @@ class GenericPage
protected function forwardToSignIn($next = '')
{
$next = $next ? '&next='.$next : '';
header('Location: ?account=signin'.$next);
header('Location: ?account=signin'.$next, true, 302);
}
/*******************/
@@ -380,6 +380,14 @@ class GenericPage
public function display($override = '') // load given template string or GenericPage::$tpl
{
// Heisenbug: IE11 and FF32 will sometimes (under unknown circumstances) cache 302 redirects and stop
// re-requesting them from the server but load them from local cache, thus breaking menu features.
header('Expires: Sat, 01 Jan 2000 01:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
if ($override)
{
$this->addAnnouncements();

View File

@@ -173,7 +173,7 @@ class SearchPage extends GenericPage
$type = Util::$typeStrings[$_['type']];
$typeId = key($_['data']);
header("Location: ?".$type.'='.$typeId);
header('Location: ?'.$type.'='.$typeId, true, 302);
exit();
}
}
@@ -200,7 +200,7 @@ class SearchPage extends GenericPage
{
// empty queries go home
if (!$this->query)
header("Location:?");
header('Location: .', true, 302);
parent::display(); // errors are handled in the search-template itself
}

View File

@@ -64,7 +64,7 @@ class UtilityPage extends GenericPage
$type = array_rand(array_filter(Util::$typeStrings));
$typeId = (new Util::$typeClasses[$type](null))->getRandomId();
header('Location: ?'.Util::$typeStrings[$type].'='.$typeId);
header('Location: ?'.Util::$typeStrings[$type].'='.$typeId, true, 302);
die();
case 'latest-comments':
$this->lvTabs[] = array(
@@ -125,7 +125,7 @@ class UtilityPage extends GenericPage
break;
case 'most-comments':
if ($this->category && !in_array($this->category[0], [1, 7, 30]))
header('Location: ?most-comments=1'.($this->rss ? '&rss' : null));
header('Location: ?most-comments=1'.($this->rss ? '&rss' : null), true, 302);
$this->lvTabs[] = array(
'file' => 'commentpreview',

View File

@@ -628,7 +628,7 @@ var PageTemplate = new function()
var menuItem = [
locale.id,
locale.description,
g_host + '?locale=' + locale.id, // sarjuuk: edited for unsupported subdomains # linkBefore + locale.domain + linkAfter
g_host + '/?locale=' + locale.id, // sarjuuk: edited for unsupported subdomains # linkBefore + locale.domain + linkAfter
null, // more custom
{rel: location.href + " domain=" + locale.domain} // also custom
];