Developer forum

Forum » CMS - Standard features » Using GetImage.ashx and CDN settings

Using GetImage.ashx and CDN settings

Adrian Ursu
Adrian Ursu
Reply

Hi Guys,

Anybody tried to use the Image resizer and the CDN setting at the same time?

In my case it always throws a 404 error and I was wondering if I miss any setting or it's a problem with the crossdomain.

Thanks,

Adrian

Replies

 
Nicolai Pedersen
Nicolai Pedersen
Reply

Sorry for not responding on this.

Can you post a dump of your settings? Should be fairly simple...

 
Adrian Ursu
Adrian Ursu
Reply

Hi Nicolai,

I just used the available settings. In the example from the dump, I have configured a cookieless local subdomain. But I tried with a CDN provider and got the same result.

Thanks,

Adrian

chrome_2017-03-10_10-07-52.png chrome_2017-03-10_10-08-05.png devenv_2017-03-10_10-08-31.png
 
Nicolai Pedersen
Nicolai Pedersen
Reply

Well - this is 404s from the CDN - meaning the CDN is configured wrong. Of course it has to serve the images on the same URL....

 
Adrian Ursu
Adrian Ursu
Reply

Hi Nicolai,

Is there any documentation on how to set up the CDN correctly?

The CDN will send 404 for the call including GetImage.ashx. Most of the other resources are loaded correctly. CSS, JS, JPG.

Thanks,

Adrian

 

 
Nicolai Pedersen
Nicolai Pedersen
Reply

I don't know... Ask whoever delivers the CDN...

In dw you have /path/to/file.jpg

Your CDN has to deliver cdnhost.domain.com/path/to/file.jpg - how that works, is defined by the CDN provider. It is not a DW thing - dw simply inserts the host in front of the path to image.

NP

 
Adrian Ursu
Adrian Ursu
Reply

Hi Nicolai,

I decided to give CDN another try.

I have set up a cloudflare account and defied the path in the CDN settings on the website.

I don't have any 404 errors anymore but the images are not resized.

I am using GetImage.ashx to resize them.

I have tried setting both paths (image and GetImage.ashx) or just the image path. I got the same outcome.

How is this supposed to be set up?

Is there even a way to make it work with GetImage.ashx?

Thanks,

Adrian

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Adrian, did you get a solution on this?

As far as I know, it is not possible to use the imagehandler on external images, and that goes for CDN as well.

but I could be wrong?

Curious to know if it can be done

 

/Hans

 
Adrian Ursu
Adrian Ursu
Reply

Hi Hans,

No. I could not make it work.

Adrian

 
Nicolai Pedersen
Nicolai Pedersen
Reply

Hi Hans and Adrian

Using GetImage for external images on a CDN makes no sense - it kind of defeats the purpose of a CDN.

GetImage does not support external ressources - you could make something your self that will handle the download of the external ressource.

You can however use a CDN for images that is created by Getimage - but how that works, depends on the actual CDN provider. Using AWS cloudfront is the easiest I've seen, because it will be able to proxy GetImage urls with no configuration at all - see this thread: http://doc.dynamicweb.com/forum?PID=1605&ThreadID=48275

Also, in these days, using a CDN sometimes can be replaced by using IIS 10 on Windows 2016, SSL certificates and Pushpromises. Rapido supports this. In this combination, the webserver switches to http2 protocol that supports push promises - that would limit a lot of http requests and boost performance a lot.

Using the pushpromises is fine for websites with limited traffic where you want to improve performance. For high volume websites, using a CDN is still worth a consideration.

BR Nicolai

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Nicolai

regarding CDN, i´m aware it makes no sense as the image would be stored on the webserver after all after being processed by the GetImage.asxh.

But i have another issue regrading CDN, and that is:

Is it posible to use a CDN while still managing and images solely from Dynamicweb? Last time I tried, we ditched it because we couldn´t find a way to get it to work without having to upload the images/files to CDN outside of Dynamicweb,  and therefore it became too cumbersome. Is this correct?

/Hans

 
Adrian Ursu
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the explanation.

It would be pretty nice to have a documented setup for the IIS +Pushpromises. it sounds like a good alternative for some situations.

And since we are at the CDN topic, I just got a question about using CDN with resources added through PIM. How would that happen? I mean, how should it be setup?

Thank you,
Adrian

 
Nicolai Pedersen
Nicolai Pedersen
Reply

CDNs works in different ways - so if you read their documentation, you would know how a specific CDN works. Again using AWS Cloudfront is simple - you can use Dynamicweb filemanager as always and Cloudfront will act like a proxy and do the work for you - it will automatically add images and other assets to its servers as they are needed and automatically update them based on your settings. Other less advanced CDNs require you to upload your images to them - that can be fine for some situations, but usually its a lot of extra work - just choose another one that do not have this requirement.

With regards to IIS + pushpromise it is really dead simple. Use IIS10, add SSL - and then you switch to http2 automatically. Then use a pushpromise on the ressources that you want covered. This is not Dynamicweb technology but common web technology. Here is how PushPromise work in .NET: https://docs.microsoft.com/en-us/dotnet/api/system.web.httpresponse.pushpromise?view=netframework-4.8
In a Dynamicweb razor template, you have a shortcut to PushPromise using @PushPromise().

Google for http2 and Pushpromises if you need more information on how it works.

CDN+PIM - I do not understand the question. Ressources in PIM are just files on disc - if you want them served from a CDN, configure that CDN to get files from your filemanager - either by using a proxy based CDN like Cloudfront or whatever that CDNs documentation says...

BR Nicolai

 
Adrian Ursu
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the clarifications.

My question for PIM is related to where you set the CDN. Assuming you are using just the PIM without Website.

Does it make sense?

Thanks,

Adrian

 

 
Nicolai Pedersen
Nicolai Pedersen
Reply

Not for me... Where and for what would you use a CDN - a content delivery network - inside PIM? I do not understand that.

CDN description: https://www.cloudflare.com/learning/cdn/what-is-a-cdn/

 
Adrian Ursu
Adrian Ursu
Reply

Hi Nicolai,
When you have documents attached to your products (or even images) and you publish your products to various channels, the CDN can help by serving those files more efficiently. I would assume that some of the channels (including Amazon, Ebay or other marketplaces) won't load the files on their servers. You are sending Product details but without the actual files. This can also apply for images. If you publish your products on a high traffic site and all of them will ask your server for those files, you might end up in a lot of trouble.

What do you think?

Adrian

 

 

 
Nicolai Pedersen
Nicolai Pedersen
Reply

I guarentee that Amazon will not accept external images - then you delete it, change it, have slow servers, its too big, too small, servers that are down etc. That will impact conversion rates, and Amazon do not play around with that. They will want the image on their servers and on their CDN under their quality control. They do things all the way, and a little further and not half :-). Same goes for their competitors I am sure. But we do not have to assume - they have documentation, and I just read small part of it, so I know they want the image uploaded and that they have a ton of requirements.

Anyways, you cannot configure a CDN for the PIM warehouse. But it is simple to add as it is simply to change the hostname of your image ressource to that of the CDN in the feed with product information. You can do that my changing the template.

BR Nicolai

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Regarding AWS CloudFront

I find it really confusing. I have googled and researched this, but have no idea where to begin. Most guides say create a bucket and upload files, but that is what I am trying to avoid. I want the CDN to dynamically fetch all files.

Any chance of Dynamicweb  or anyone else making a guide, or link to the direct guide/tutorial on how to set this up?

 

/Hans

 

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

@Nicolai, when getting the Cloudfront to act as a proxy, it will have to deliver the whole website, correct? It is not possible to get it to act as a proxy for just delivering images and files?

/Hans

 
Nicolai Pedersen
Nicolai Pedersen
Reply
This post has been marked as an answer

No, it will deliver whatever - see below my setup. In that way I can add "https://dgql1r6b914aj.cloudfront.net" instead of "https://www.dynamicweb.dk" to any ressource or page on my website. And I then JUST add that (https://dgql1r6b914aj.cloudfront.net) in front of images and ressources and not pages.

So https://www.dynamicweb.dk/Files/Images/DWLogoColor_sm.svg becomes https://dgql1r6b914aj.cloudfront.net/Files/Images/DWLogoColor_sm.svg

And using the 2 settings on a website in Dynamicweb will replace (or add) https://dgql1r6b914aj.cloudfront.net/ to all img style etc ressources.

BR Nicolai

Capture.PNG Capture1.PNG Capture2.PNG Capture3.PNG
Votes for this answer: 1
 
Nicolai Pedersen
Nicolai Pedersen
Reply

And the guide is here: https://aws.amazon.com/getting-started/tutorials/deliver-content-faster/

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

ok, thank you :)

 

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

 If someone want´s to try at much more simple super easy to set up CDN, i recommend https://bunnycdn.com/

Apart from the funny name (that you can change if you eg setup a CNAME record for your own domain to point to this ). I like it very mutch. Took me 2 mins to setup, after hassling with Cloudfront for hours.

Feel free to ask

/Hans

 

 
Nicolai Pedersen
Nicolai Pedersen
Reply

Looks nice, thanks for sharing!

 

You must be logged in to post in the forum