Understanding the Problem
Lab: Remove Query String from Static Resource URL
Video Runtime: 14:01
In this episode, let’s discuss what the problem is with using URL query string. It’s important for you to understand the problem first in order to solve it. Right? Do this episode before you move on.
Let’s start by analyzing the speed of this lab using Pingdom’s website speed test. Here’s a link to the test that I ran.
Running the test, it explains why it scores query strings:
Resources with a “?” in the URL are not cached by some proxy caching servers.
Therefore, the problem is that some proxy caching servers may not cache the resources. That means anything connected to those servers are not benefiting from caching.
NOTE: Browsers still can locally cache.
What is a “Proxy Server”?
In this episode, I explain what a proxy server is as well as why we should care about a proxy being able to cache our website’s assets and resources.
I reference this article on MaxCDN’s blog: What is Proxy Caching?. I recommend that you read this article to understand the problem further.
The problem is not the score or trying to get a better score on a site like Pingdom. Rather, the problem is:
Users connected on networks that use proxy servers may not get the maximum benefit of proxy caching.
While they can cache locally, their network is not benefiting from centralized caching to deliver an even faster experience.
Your functions are bloated. Put them on a diet. Think "skinny" and "as few lines as possible."
Total Lab Runtime: 03:18:22
- 1 Lab Introductionfree 09:30
- 2 What is a URL Query String?free 14:36
- 3 The Intent of ?ver=1.0.0free 12:22
- 4 Understanding the Problemfree 14:01
- 5 Cache Busting Strategiesfree 09:57
- 6 Planning Our Pluginpro 18:17
- 7 Versioning Utility Helper Filepro 08:36
- 8 Start the URL Converter Classpro 18:11
- 9 Hook into WordPresspro 11:57
- 10 Regex or Parse the URL?pro 12:30
- 11 Convert with Regexpro 06:10
- 12 Apache and Nginx Rewrite Rulespro 10:43
- 13 Deciding Whether to Convertpro 07:35
- 14 Skip When No Version Query Stringpro 09:18
- 15 Only the Local Assetspro 14:09
- 16 Improving Our Code & Readabilitypro 11:52
- 17 Test, Fine-Tune, and Wrap it Uppro 08:38