<p>I don't think it's a great idea to disable this cache busting; they put it in there for a reason.  However, if you really need/want to do it, instead of modifying Craft, I'd just configure Apache/Nginx to discard the query string for paths that match <code>/admin/resources/</code></p>

<p><a href="https://wiki.apache.org/httpd/RewriteQueryString" rel="nofollow">https://wiki.apache.org/httpd/RewriteQueryString</a></p>

CC BY-SA 3.0
2016-08-22T17:54:32.743Z
Thanks! That would do the job, but I agree that it's probably not a great idea - future changes to static files won't appear in users' browsers because of the caching.

What I'd really love is a way to trigger that [`$dateParam` logic](https://github.com/pixelandtonic/Craft-Release/blob/768ba7b2afd471771f6f449b28308c7e1fe8fefd/app/helpers/UrlHelper.php#L275-L288) for all the static files, so that they deterministic `?d=` query parameters instead of random `?x=` query parameters, thus getting both browser-side caching and also graceful cache invalidation when updates happen.
Chris MacDonald
CC BY-SA 3.0
2016-08-23T05:11:56.927Z
If you're going through the trouble of dropping the query string, theoretically you could setup how far out the cache should be on the admin side as well, say an hour or 2 depending on how long your authors are in the site for.
RitterKnight
CC BY-SA 3.0
2016-08-22T14:52:23.253Z
2016-08-22T14:52:23.253Z
andrew.welch
<p>I notice that the Craft admin pages append random query parameters to their static files, i.e. <code>jquery-2.2.1.min.js?x=AKVKl03So</code>:</p>

<p><a href="https://i.sstatic.net/bhOl0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bhOl0.png" alt="example network data from admin, showing query parameters"></a></p>

<p>This prevents those static files being cached in browsers, which can make the admin views unreliable in less-than-optimal network conditions.</p>

<p>I see the logic to make this happen is in Craft's <a href="https://github.com/pixelandtonic/Craft-Release/blob/768ba7b2afd471771f6f449b28308c7e1fe8fefd/app/helpers/UrlHelper.php#L254-L307" rel="nofollow noreferrer"><code>app/helpers/UrlHelper.php</code></a></p>

<p>Is there a sane way to deactivate that behavior, and allow browsers to cache Craft's static files?</p>

<cache><admin>
How to allow browsers to cache Craft's admin static files?
# How to allow browsers to cache Craft's admin static files?

(Asked by: username_0 on 2016-08-22)

I notice that the Craft admin pages append random query parameters to their static files, i.e. `jquery-2.2.1.min.js?x=AKVKl03So`:

[![example network data from admin, showing query parameters](https://i.sstatic.net/bhOl0.png)](https://i.sstatic.net/bhOl0.png)

This prevents those static files being cached in browsers, which can make the admin views unreliable in less-than-optimal network conditions.

I see the logic to make this happen is in Craft's [`app/helpers/UrlHelper.php`](https://github.com/pixelandtonic/Craft-Release/blob/768ba7b2afd471771f6f449b28308c7e1fe8fefd/app/helpers/UrlHelper.php#L254-L307)

Is there a sane way to deactivate that behavior, and allow browsers to cache Craft's static files?

**Tags:** cache, admin

---

## 1 answers

### Answer by username_1 on 2016-08-22. Score: 2 | Accepted answer

I don't think it's a great idea to disable this cache busting; they put it in there for a reason. However, if you really need/want to do it, instead of modifying Craft, I'd just configure Apache/Nginx to discard the query string for paths that match `/admin/resources/`

<https://wiki.apache.org/httpd/RewriteQueryString>

> **Comments:**
> **username_0**: Thanks! That would do the job, but I agree that it's probably not a great idea - future changes to static files won't appear in users' browsers because of the caching.  What I'd really love is a way to trigger that [`$dateParam` logic](https://github.com/pixelandtonic/Craft-Release/blob/768ba7b2afd471771f6f449b28308c7e1fe8fefd/app/helpers/UrlHelper.php#L275-L288) for all the static files, so that they deterministic `?d=` query parameters instead of random `?x=` query parameters, thus getting both browser-side caching and also graceful cache invalidation when updates happen.  
> **username_2**: If you're going through the trouble of dropping the query string, theoretically you could setup how far out the cache should be on the admin side as well, say an hour or 2 depending on how long your authors are in the site for.  

---

