Jump to content
MDDHosting Forums

cookie-less subdomain


Adam
 Share

Recommended Posts

I have been trying to server all my static content from a cookie-less subdomain because it is supposed to improve site performance. I am having trouble getting my subdomain to not leave cookies. I am running a wordpress site on that domain and I put this into the wp-config.php:

 

define('COOKIE_DOMAIN', 'lrastart.org');

 

My site is in my signature.

Link to comment
Share on other sites

I have been trying to server all my static content from a cookie-less subdomain because it is supposed to improve site performance. I am having trouble getting my subdomain to not leave cookies. I am running a wordpress site on that domain and I put this into the wp-config.php:

 

define('COOKIE_DOMAIN', 'lrastart.org');

 

My site is in my signature.

 

Give this a try:

define('COOKIE_DOMAIN', '.lrastart.org');

Link to comment
Share on other sites

  • 6 months later...

I have been trying to server all my static content from a cookie-less subdomain because it is supposed to improve site performance. I am having trouble getting my subdomain to not leave cookies. I am running a wordpress site on that domain and I put this into the wp-config.php:

 

define('COOKIE_DOMAIN', 'lrastart.org');

 

My site is in my signature.

 

useful post...good work...

Link to comment
Share on other sites

There are a few parts to accomplishing this.

 

First you must move the images to a different (sub)domain that is not included in any cookies you set. If the cookie is for example.com, then any subdomain is fine. If the cookie domain is .example.com (notice the leading dot), all subdomains would get the cookies and you would need to host the images on an entirely different domain.

 

Second you would need WordPress to "know" that these images are located in a different location. I imagine there must be a plugin for this, but I am not aware of any off hand.

 

Lastly, you need to be sure that nothing on the domain you use for images creates any cookies.

 

You could also look into using a CDN service for this which would add some additional benefits (and costs, generally). We also offer a plugin for CloudFlare which provides a lot of optimizations, bandwidth savings, and even improves your security. Their basic plan is not only free, but very feature rich. They also offer premium plans with enhanced features and SSL support. With regards to CloudFlare, I strongly advise using the cPanel plugin instead of signing up with CloudFlare directly. The plugin does a lot of DNS work in the background and saves you a lot of headache in the event of IP address changes.

Link to comment
Share on other sites

Sorry for not updating this thread. I decided that it wasn't really necessary after all.

 

First you must move the images to a different (sub)domain that is not included in any cookies you set.

 

Although this would work, it's not the easiest way to do it. You could set a CNAME subdomain to point to your domain and call static resources from that subdomain. You don't have to move anything this way.

 

Second you would need WordPress to "know" that these images are located in a different location. I imagine there must be a plugin for this, but I am not aware of any off hand.

 

W3TC has a feature that allows you to have a "self-hosted CDN" and it does exactly this.

 

Lastly, you need to be sure that nothing on the domain you use for images creates any cookies.

 

That's what I had trouble with.

 

You could also look into using a CDN service for this which would add some additional benefits (and costs, generally). We also offer a plugin for CloudFlare which provides a lot of optimizations, bandwidth savings, and even improves your security. Their basic plan is not only free, but very feature rich. They also offer premium plans with enhanced features and SSL support. With regards to CloudFlare, I strongly advise using the cPanel plugin instead of signing up with CloudFlare directly. The plugin does a lot of DNS work in the background and saves you a lot of headache in the event of IP address changes.

 

I've been using CloudFlare before most people knew they existed, actually. I didn't know that the CF cPanel plugin does backend DNS work; that's interesting.

Link to comment
Share on other sites

  • 2 weeks later...
I've been using CloudFlare before most people knew they existed, actually. I didn't know that the CF cPanel plugin does backend DNS work; that's interesting.
It just modifies the www. CName to point at CloudFlare. The downside is that if you don't use the www. (i.e. your site without www. in front) then you'll need to change this behavior to use the www. or use CloudFlare's DNS.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...