Error

How to Fix “Serve Static Content from a Cookieless Domain” Warning

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.

What Causes the Error to Appear?

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.the Serve Static Content from a Cookieless Domain is usually appear in pingdomThese 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.

Basically, this warning will occur when your web server uses cookies. It means that every HTTP request from your site will contain these cookies, including the ones for static content like images, Javascript, and CSS.

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!

Fixing Serve Static Content from a Cookieless Domain Warning

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.

1. Using CDN

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.KeyCDN is the easiest way to fix Serve Static Content from a Cookieless DomainLuckily, 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.enable the strip cookie option in keyCDN to fix the Serve Static Content from a Cookieless Domain

As a result, your site will load faster and you will not get the “Serve Static Content from a Cookieless Domain” anymore.

2. Creating a Subdomain

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:

Step 1: Create a Subdomain

Go to your site’s control panel, choose Subdomains.click on subdomains in your site's control panelClick on Create a New Subdomain. Type in your preferred subdomain name as well as the domain that follows.make sure that you are on "create a new subdomain" pageClick Create, and your subdomain is up and running!

click on create on this pageIf 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.manage your subdomains through the list of current subdomain

Step 2: Point Your Subdomain to The Main Domain in CNAME

Now, you need to point the new subdomain to your site’s main domain. If you use Hostinger, you can configure it with the DNS Zone Editor. Follow these steps:

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.go to DNS Zone under domains sectionYou 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.add new CNAME and ignore anything elseClick 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).

you need to fill in host and points to

Step 3: Point Your Subdomain to The WordPress Directory

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.

Conclusion

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!

About the author

Arief Fajar Gumilar

Arief is a passionate digital content writer for Hostinger International and full-time SEO enthusiast. He enjoys writing as much as listening to Ed Sheeran old albums and EPs. Follow him on Twitter @agoomilar to find out his latest lame jokes and puns.

Add Comment

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Exclusive Content

Join thousands of webmasters who get our free newsletter with tips on how to drive more traffic and revenue to their websites!

Please wait...

Thank you for sign up!