Note: Due to recent changes with the web and new protocols such as HTTP/2, this warning can usually be safely ignored now. The cost of a new connection is usually costlier than streaming everything over the same connection. HTTP/2 does amazing things now with parallelism. And cookies themselves are generally very small.
Another thing to be aware of is that the Pingdom tool itself does not actually support HTTP/2 because it’s currently using Chrome 39 to run its tests. Chrome didn’t support HTTP/2 until version 49. So keep in mind that Pingdom is not fully up to date with its warning. Although it will once they upgrade their test machines.
Depending upon the tool or software reporting it, the warning might appear in a couple different ways:
- “serve the following static resources from a domain that doesn’t set cookies”
- “serve static content from a cookieless domain”
But if you still want to set up a separate domain to serve up cookies, here are the directions below.
Fix Serve Static Content From a Cookieless Domain Warning
There are a couple ways to fix the “serve static content from a cookieless domain” warning, such as using a CDN and also re-configuring your WordPress site.
- Use a CDN
- Re-Configure WordPress Site
1. Use a CDN
One easy way to fix this warning is to use a CDN provider that has the ability to ignore cookies as well as strip cookies which will completely prevent the client from receiving the Set-Cookie response header. KeyCDN is one CDN provider that does offer this feature. By default, you can see the following two options are enabled. This is an easy alternative without having to mess with moving and configuring your site to deliver static assets from a separate subdomain.
Note: You cannot disable cookies on resources served through CloudFlare. CloudFlare also includes their own security cookie in your header. Again these cookies are very small and the performance implications are extremely minimal. But if you use CloudFlare, there is no way to get around this warning.
2. Re-Configure WordPress Site
The second option you have is to re-configure your WordPress site to deliver the static assets from a new domain or subdomain. Note: If you use a top-level domain such as domain.com, then you would need to actually use a separate domain altogether. If you are using www.domain.com then you could simply set up a subdomain such as static.domain.com. In this example, we will assume your website is on www.domain.com.
- First, create a subdomain such as static.domain.com. This is where you will deliver all your files from.
- Point your subdomain to your /wp-content directory with a CNAME.
- Edit your wp-config.php file to reflect the following: