Skip to content

Instantly share code, notes, and snippets.

@nextgens
Created March 16, 2017 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nextgens/ca501d3c1b149a62c09b0b409e0651a7 to your computer and use it in GitHub Desktop.
Save nextgens/ca501d3c1b149a62c09b0b409e0651a7 to your computer and use it in GitHub Desktop.
Enable browser caching of mtc.js as described in https://github.com/mautic/mautic/issues/3656
diff --git a/app/bundles/CoreBundle/Controller/JsController.php b/app/bundles/CoreBundle/Controller/JsController.php
index 1bd7fda30..a108d9e85 100644
--- a/app/bundles/CoreBundle/Controller/JsController.php
+++ b/app/bundles/CoreBundle/Controller/JsController.php
@@ -33,7 +33,7 @@ class JsController extends CommonController
$dispatcher->dispatch(CoreEvents::BUILD_MAUTIC_JS, $event);
}
- return new Response($event->getJs(), 200, ['Content-Type' => 'application/javascript']);
+ return new Response($event->getJs(), 200, ['Content-Type' => 'application/javascript', 'Cache-Control' => 'public, max-age=7200']);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment