May 26, 2019
May 26, 2019
If you suddenly get the “Serve Static Content from a Cookieless Domain” warning while monitoring your website, you are definitely not alone! Many WordPress users get the same message every day. Hence, this warning is quite common, and can easily be fixed if you know the right way to do it.
In this article, we are going to provide two effective methods to fix this warning: using a CDN and creating a subdomain.
However, before starting, note that the warning sometimes appears as “serve the following static resources from a domain that doesn’t set cookies.” If you happen to stumble upon this message, these methods can also be used to fix it.
As a WordPress user, you might have familiarized yourself with a lot of website monitoring tools, like Pingdom, GTmetrix, Google PageSpeed Insights. These tools are very powerful for helping find ways to improve your site’s performance.These monitoring sites can give you “warnings” if there are one or several things that interfere with your site’s overall performance, and the “Serve Static Content from a Cookieless Domain” warning is just one of them.
As you might know, static content does not require cookies, it will only add more burdens to your site if it’s activated, slowing down performance. Thus, causing the monitoring program to produce the “Serve Static Content from a Cookieless Domain” message.
It is worth to note that using HTTPS with HTTP/2 will completely fix this error. If this warning still appears when you have already used these protocols, it can be completely ignored. Do not worry, it is safe!
As we have mentioned above, there are two viable methods to fix this warning; using a CDN or creating a subdomain. Both are very effective and easy to implement.
A CDN (Content Delivery Network) is an effective way of solving the Serve Static Content from a Cookieless Domain error and speeding up your website. CDN services use a technique called “content replication” that will duplicate your content at various data centers.
When you run your blog through a CDN, all website files will be loaded through their server instead of your hosting server, thus speeding up the site’s loading time and reducing server load.
A CDN is also able to ignore cookies from static files that often weight the connection between servers. This feature is the one that can help you overcome the problem.
We recommend using KeyCDN. This particular provider has everything you need to create a stable, fast, and cookieless connection.Luckily, the service is quite cheap. The pricing starts at only $0.04/GB. This price includes the full CDN service, such as HTTP/2, TLS 1.3, and Brotli support.
To clean the static asset’s cookies, you only need to enable the Strip Cookies feature on KeyCDN. This setting will automatically strip all cookies and prevent further latency.
As a result, your site will load faster and you will not get the “Serve Static Content from a Cookieless Domain” anymore.
Another method to resolve the Serve Static Content from a Cookieless Domain error is by creating a subdomain from which your static content will be served without cookies.
While creating a subdomain is a bit more complicated than using a CDN, this method does not require you to spend a penny since most web hosting providers, including Hostinger, allow you to create a subdomain for free.
Nonetheless, note that the method will not work if you are using a top-level domain (mydomain.com) instead of the regular one (www.mydomain.com).
If you use the top-level domain, you need to purchase a new domain to create the subdomain.
To fix serve static error using the subdomain, follow these simple steps:
Go to your site’s control panel, choose Subdomains.Click on Create a New Subdomain. Type in your preferred subdomain name as well as the domain that follows.Click Create, and your subdomain is up and running!
If you are using more than one subdomain and intend to delete or configure them, click on the List of Current Subdomains on the same page.
Go to your site’s control panel, then click on DNS Zone Editor. In this page, you will find some DNS records. The records are used to point your domain and subdomain to a specific IP address.You will find a lot of different sections, such as A (Host), CNAME (Alias), MX (Mail Exchanger), etc. However, what you need to do is Add new CNAME record.Click Add New, then fill in Host with the subdomain name that you intend to use. You also need to fill in Points to with your site’s main domain. Leave the TTL section as default (1/2 hour).
The last thing you need to do is point the subdomain to the WordPress directory that you intend to use. To do this, you have to access the wp-config.php file. To access it, you can use an FTP client like FileZilla.
The default location of wp-config.php is your domain’s document root directory. Locate the file, then paste in this code:
define(“WP_CONTENT_URL”, “http://static.mydomain.com”); define(“COOKIE_DOMAIN”, “mydomain.com”);
Save it and exit.
Now that you have finished the whole process to fix the “Serve Static Content from a Cookieless Domain” error, you should not find the warning anymore while monitoring your site’s performance.
Encountering “Serve Static Content from a Cookieless Domain” while monitoring your site’s performance via Pingdom, GTmetrix, Google PageSpeed Insights should no longer be a problem since there are two very effective methods to resolve it:
First, using a CDN that has the ability to trim all static cookies directly from its server. It can also speed up your site by creating a duplicate of your data on many servers, so your website does not need to load it all at once.
The second method to resolve the serve static error is creating a subdomain. Although this method is not as simple as using a CDN, it is completely free and very effective.
All you need to do is create a subdomain through your hosting provider’s control panel, then point it to your site’s main domain by configuring the subdomain in the DNS Zone Editor.
Finally, we hope that this tutorial helps you to fix the serve static error. Let us know if you have any question by leaving a comment below!