How to solve [Serve the following static resources from a domain that does not set cookies]

I'm struggling with something that I donโ€™t know at all. When I ping my site, I got this result: [Serve the following static resources from a domain that doesn't set cookies:] . And this result is caused by the images that I used for background images. I tried to deal with this topic, but all the answers seem hard to understand. Does anyone know about this and some simple solution to fix it?

+6
source share
3 answers

I will try to give a very high level review, since you did not ask a lot of questions in your question. Keep in mind that there are many ways to solve this problem, and I will try to give one solution, which, it seems to me, is easy to understand.

This post assumes that if your site is www.company.com , you should download static content from www.companycdn.com . And this new site ( www.companycdn.com ) is a simple static website that does not support cookies.

To do this, you need to upload your static resource (for example, images) to the second domain.

And then update the image paths to the new domain. For example, instead: <img src="logo.jpg"/> , you should change it to <img src="//www.companycdn.com/logo.jpg"/>

This answer contains additional information: https://webmasters.stackexchange.com/questions/1772/how-do-i-set-up-a-cookie-less-domain

+7
source

Typically, when you serve content such as images, JavaScript, CSS, there is no reason to support an HTTP cookie, as it creates additional overhead. This is why many tools report this. Here are two quick and easy options:

Option 1 - Use CDN

Use the CDN to place your images, which may ignore cookies, as well as cookies, which completely prevent the client from receiving a Set-Cookie response header. Note. You cannot disable cookies in Cloudflare .

Option 2 - Point Static Assets for a New Domain

This is an example with WordPress.

  • First create a subdomain such as static.domain.com. Here you will send all your files.
  • Direct your subdomain to the / wp -content directory with CNAME.
  • Edit the wp-config.php file to display the following:

 define("WP_CONTENT_URL", "http://static.domain.com"); define("COOKIE_DOMAIN", "domain.com"); 

Read more in this post on how to fix Provide a warning about static content from Cookieless Domain .

+4
source

If you are new to this. I want you to first tell you that as soon as you set a cookie, it will be sent to the server for each request.

Default character: it will be sent to all requests sent to your parent domain and all its subdomains. Here's how cookies work on everything.

So, to increase the speed of your site, you do not overload your HTTP requests. If you cut cookies, it will be better.

Now let's move on to how to do this. Use a different domain name, you can also restrict some subdomains from setting a cookie, but in the long run this may become a liability for refusal.

For example, Quikr has a parent domain http://www.quikr.com/ , but downloads all static resources from kuikr.com

http://teja1.kuikr.com/public/images/dist/RECarousel/hospitality_jobs.png

Hope this helps. Thanks!

+1
source

All Articles