Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Static content from cookie free domains


GLWalker

Recommended Posts

Anyone ever tried serving their scripts, stylesheets and images from a cookie free domain?

 

I am about to try to see how it effects page load speed/inital load size.

 

What I have found so far is the domain needs to use the www prefix to catch the cookies for the main domain

 

A subdomain needs to be created on the FQD and then the subdomain needs to point to the root path of the www.domain

 

The rest is all experimerntation and I wont be able to go further untill I change DNS settings on the site I'm going to try it on.

 

For images I do assume I may need to change either:

 

A) DIR_WS_IMAGES path

or

B) the tep_image function

 

this is so the image will be looked up at the subdomain.domain, though in actuallity the images folder will never move as the subdomain will point to the same place.

 

Any hints, tips, tricks, whys or why nots?

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Link to comment
Share on other sites

Gary please do. It's something I've been meaning to play with, but never found the time.

 

It'll take some doing - particularly in the initial save of the image to the CDN [this is where I thought most of the work would be], and reading the image from the CDN.

Link to comment
Share on other sites

@@burt

@

Gary and Gary, here's a site @@npn2531 posted about that is along these lines. It's been on my to do list for quite a while, along with several dozen or so to dos I haven't done yet. :wacko:

 

http://www.css-oscommerce.com/pagespeedserve-static-content-from-a-cookieless-domain/

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

Did this about a year ago and it works very well for me.

 

Just added some lines to configure.php

 

define('IMAGE_SERVER_A', 'http://imga.xxxxxx.co/images/');

define('IMAGE_SERVER_B', 'http://imgb.xxxxxx.co/images/');

define('IMAGE_SERVER_C', 'http://imgc.xxxxxx.co/images/');

 

and altered the code to share image serving between those 3 domains. Found that worked better than using a CDN.

 

Having a fast site is important to me and this was just one of a number of changes made in order to achieve this.

Link to comment
Share on other sites

So, what exactly are you trying to accomplish here? Are cookies a problem on an add-on domain or subdomain? On some sites, per host practices? If you're worried about that silly EU rule about cookies, AFAIK it applies only to tracking cookies, not cookies vital to the operation of a site. You might mention that you have such [non-tracking] cookie(s) on a Privacy or Cookies page, and leave it at that. There's certainly no need to ask permission to use non-tracking cookies.

Link to comment
Share on other sites

The topic is not about the setting of cookies in that sense.

 

Serving content from a CDN (cookieless domain) will speed up overall page rendering. To what degree remains to be seen, and is the overall cost/effort worth it.

 

It's simple to hack it as per the post in the css-oscommerce blog and the post of @@cornishpirate

The hard part is to get it working within the usual osCommerce way of doing things, saving the image(s) when adding/editing products to the CDN.

Link to comment
Share on other sites

@@burt

@

 

Another issue I ran into when messing with this was the need for the CDN images to be served via SSL for secure parts of the site. The additional cost of an extra SSL certificate (even some CDN's charge extra for the use of SSL connections) combined with the hassle of setting everything up made me not want to pursue this too much. I guess it really comes down to how busy your site is and how much you need to do extra performance optimizations.

Matt

Link to comment
Share on other sites

I guess it really comes down to how busy your site is and how much you need to do extra performance optimizations.

 

How fast is fast enough for Google anyway? A site I am working on pretty much shows very good "grades" from a couple page speed sites I use. Meaning like they give the site 90% or an A- or such for "speed". So is struggling to improve that really worthwhile?

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

@@altoid

So is struggling to improve that really worthwhile?

 

Thats a really good question, thus is the reason to experiment and find out. The site I'm planning to do it on currently has a 92% running yslow, and the biggest slowdown comes from static content being served with needless cookies attached.

 

The way I see it, the more content we place up on the web, the more tax we place on our resources that power the web. If we can serve static content in a way that does not take three days and three hundred dollars to set up, then we not only enjoy a slight reduction in loading time, even if it is 1 and 1/10th of a millisecond per file served, but the more site owners pursue the same practice, the overall burdenn on resources starts to free up, all while speeding up the sites visited.

 

I'm not an environmentalist trying to be green at any cost, my true thoughts would probably anger those who are, but I do like to see "less is more" on all fronts.

 

Basically its akin to one who optimized PHP code for the best performance and lowest ammount of queries to the database to serve a page. Its just another aspect of optimization.

 

@@mattjt83

 

The SSL part is going to be tricky without purchasing 2 certs or a wildcard cert, though there may be some getting around it with help of the .htaccess file.

 

 

I have not yet had time to start on this, but do plan to very soon. The feed back here has been great and will help. Thanks

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Link to comment
Share on other sites

 

Basically its akin to one who optimized PHP code for the best performance and lowest ammount of queries to the database to serve a page. Its just another aspect of optimization.

 

 

I'll get around to trying this eventually probably using the blog post above, if for nothing more that just to see what happens. I already have a domain to hold the static content, and getting a cheap ssl for it should cover that part.

 

The cumbersome part as I see it is maintaining the static content on that site. Seems with addition/deletion of products etc over time I'd have to remember to copy images from the shop site over to the static content cookie free site. Not that big a deal but a bit cumbersome anyway.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

gtmetrix.com is a good site to visit to measure page speed and to determine in what areas you need to still optimise your site and possibly the server - well for those who have VPS and full root access.

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

I have tried this with a subdomain but it did not improve anything in gtmetrix. I think if I were to do this properly I need to register another domain. For my site it is not really worth it because it is small.

How fast is fast anyway for google. Say if you got load time of 1.5 seconds in gtmetrix is that fast or slow?

Link to comment
Share on other sites

When I tried to use a sub-domain, stat.example.com, to load the images by changing in configure.php the images path to http://stat.exmaple.com/images/ I got an error with bxgallery saying "your content cannot be loaded at this time, please try again later." when I tried to enlarge the pop up images of my products.

 

I do not have this issue once I switch back to calling the images from the old path, without using stat.example.com.

 

stat.example.com is not cookieless anyway. I think I need to buy a different domain to make it cookieless. But will this error occur again with a new domain?

Link to comment
Share on other sites

Did this about a year ago and it works very well for me.

 

Just added some lines to configure.php

 

define('IMAGE_SERVER_A', 'http://imga.xxxxxx.co/images/');

define('IMAGE_SERVER_B', 'http://imgb.xxxxxx.co/images/');

define('IMAGE_SERVER_C', 'http://imgc.xxxxxx.co/images/');

 

and altered the code to share image serving between those 3 domains. Found that worked better than using a CDN.

 

Having a fast site is important to me and this was just one of a number of changes made in order to achieve this.

 

I have just tried to implement something similiar to my site. Seems to be working. Thanks.:)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...