{"id":27423,"date":"2018-07-06T06:08:17","date_gmt":"2018-07-06T11:08:17","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=27423"},"modified":"2022-12-19T06:49:09","modified_gmt":"2022-12-19T12:49:09","slug":"serve-static-content-from-a-cookieless-domain","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/serve-static-content-from-a-cookieless-domain\/","title":{"rendered":"Serve Static Content From a Cookieless Domain"},"content":{"rendered":"
<\/div>
<\/p>\n
We’ll show you how to fix serve static content from a cookieless domain<\/strong> error. When using a website analyzer tool such as PageSpeed Insights, GTMetrix, Pingdom, or Uptrends, a warning will often appear that says “Serve Static Content From a Cookieless Domain”<\/strong>. What this means is that your web server is setting cookies \u00a0– this causes all future HTTP requests to include this cookie, creating unwanted network traffic. This in turn only slows down the speed of your website when a user tries to access it. If you need your website to be as fast as possible, switching to a cookieless domain is the way to go. A cookieless domain does not accept any cookies from any browsers, keeping the overall network traffic lower. The goal is to serve all static content – such as images, javascript, CSS, and more – all through a static, cookieless domain, which helps improve the speed at which these resources are downloaded.<\/p>\n
<\/p>\n
<\/p>\n
In this tutorial, we will cover how to set up a cookieless domain in order to resolve this warning message. There are two ways to create a cookieless domain: use a new domain to serve static content, or use a subdomain\u00a0to serve the static content. Using a subdomain is the most popular choice, since it doesn’t require the purchase of a new domain name – this is the method we will be covering today. However, using a new domain instead of a subdomain can be made to work easily enough with this tutorial. This tutorial discusses how to set up a cookieless domain on a Linux-based server.<\/p>\n
NOTE:\u00a0<\/strong>You\u00a0cannot<\/strong> use a subdomain to serve static content if your main website is setting cookies by using the root of your domain instead of the ‘www’ prefix. If your site is setting them by using yourdomain.com instead of www.yourdomain.com, then using a subdomain to serve static content\u00a0is not possible<\/strong>. This is due to the fact that using it on the root domain also applies it to all subdomains.<\/p>\n