Skip to content

Commit

Permalink
Disable HTTP caches on preview links (for 2.x)
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Jul 20, 2018
1 parent 73abb79 commit 5682390
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Controllers/ShareDraftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
use SilverStripe\Control\Session;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\FieldType\DBHTMLText;
Expand Down Expand Up @@ -50,6 +51,9 @@ class ShareDraftController extends Controller
*/
public function preview(HTTPRequest $request)
{
// Ensure this URL doesn't get picked up by HTTP caches
HTTPCacheControlMiddleware::singleton()->disableCache();

$key = $request->param('Key');
$token = $request->param('Token');
try {
Expand Down

0 comments on commit 5682390

Please sign in to comment.