locked
Serve static content from a cookieless domain RRS feed

  • Question

  • User632304213 posted

    How to <g class="gr_ gr_23 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins replaceWithoutSep" id="23" data-gr-id="23">fix</g> Serve static content from a cookieless domain for my website of

    http://www.nxtproject.com/

    Friday, March 16, 2018 8:41 AM

All replies

  • User283571144 posted

    Hi Gokulakrishnan,

    gokularts2012

    How to fix Serve static content from a cookieless domain for my website of

    As far as I know, this warning suggest you host the static content from the cookieless domain.

    According to this article.

    Static content, such as images, JS and CSS files, don't need to be accompanied by cookies, as there is no user interaction with these resources. You can decrease request latency by serving static resources from a domain that doesn't serve cookies. This technique is especially useful for pages referencing large volumes of rarely cached static content, such as frequently changing image thumbnails, or infrequently accessed image archives. We recommend this technique for any page that serves more than 5 static resources. (For pages that serve fewer resources than this, it's not worth the cost of setting up an extra domain.)

    To reserve a cookieless domain for serving static content, register a new domain name and configure your DNS database with a CNAME record that points the new domain to your existing domain A record. Configure your web server to serve static resources from the new domain, and do not allow any cookies to be set anywhere on this domain. In your web pages, reference the domain name in the URLs for the static resources.

    If you host your static files using a CDN, your CDN may support serving these resources from another domain. Contact your CDN to find out.

    I suggest you could try below two way to fix this warning. 

    1.Use a CDN

    Use a CDN to host your images which has the ability to ignore cookies as well as strip cookies which will completely prevent the client from receiving the Set-Cookie response header. Note: You can't disable cookies on Cloudflare.

    2.Point Static Assets to New Domain

    This is an example with WordPress.

    1.First, create a subdomain such as static.domain.com. This is where you will deliver all your files from.
    2.Point your subdomain to your /wp-content directory with a CNAME.
    3.Edit your wp-config.php file to reflect the following:

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

    Best Regards,

    Brando

    Monday, March 19, 2018 9:07 AM