In certain circumstances, adding the css_js_query_string value can cause performance problems, especially in situations where reverse proxies are used. It would be useful to have a way of disabling this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Active » Needs work
FileSize
1.76 KB

Here's a patch that provides a new variable, "skip_css_js_query_string", that will skip adding the query string to the JS and CSS file paths. This variable defaults to FALSE.

FYI I'm providing a D6 patch for now, will provide a D7 patch later.

DamienMcKenna’s picture

FYI corresponding patches have been supplied for the Zen theme for all three active branches: [#http://drupal.org/node/772234]

c960657’s picture

Under which circumstances is the query string a performance problem?

DamienMcKenna’s picture

The primary use case I was presented with was when using a reverse proxy, e.g. Varnish, to cache the compiled JS & CSS, these services usually are configured to not cache URLs with query strings included.

c960657’s picture

Is there any good reason to configure you reverse proxy that way if it only proxies a Drupal site? The mod_expires rules in .htaccess instructs Apache to send cache-friendly HTTP headers for static files, so if the reverse proxy chooses to ignore these if the URL contains a query string, I'd say the proper solution is to fix the reverse proxy configuration.

DamienMcKenna’s picture

Double-checking with our server admin - some reverse proxy engines, e.g. Squid, are not intelligent to handle it properly so a patch like this is needed. Other reverse proxy engines, like Varnish, are flexible enough to handle more complicated settings like this and so for these the patch isn't needed. For people who use Squid this patch could help.

c960657’s picture

Status: Closed (won't fix) » Needs work

This thread covers Squid's default behaviour now and historically:
http://www.mail-archive.com/squid-users@squid-cache.org/msg57407.html
http://www.mail-archive.com/squid-users@squid-cache.org/msg57480.html

AFAICT older versions of Squid did not cache URLs with a query string by default, but it could be configured to do so. Newer versions of Squid should cache these URLs just fine, if they are served with proper Cache-Control headers. I don't have a Squid at hand for testing, but I don't remember any problems of that kind when I was administering Squids a while back.

DamienMcKenna’s picture

Status: Needs work » Closed (won't fix)

Thanks for the insight. I guess this status update covers it then?

c960657’s picture

As mentioned in #721400-72: Order JS files according to weight, don't change filenames for aggregated JS/CSS some proxies of the ISP/company kind (not reverse proxies) may be configured like the very old versions of Squid, so they wont cache URLs with a query string in them. When Drupal add a query string to the JS and CSS files, users of these misconfigured proxies will see a slightly decreased performance, though not worse than if they accessed the internet directly (without the proxy) on the same internet connection. If they are on a very bad internet connection, you would expect them to configure their proxy to cache as much as possible. I'd expect these misconfigured proxies to be rather rare, so I don't think it's worth adding extra code to Drupal.

In other words: Yes, I agree that it's a won't fix :-)

Status: Needs work » Closed (won't fix)