Using AWS CloudFront as CDN

  • Has anyone tried to set up AWS CloudFront with Backendless?
  • Should I follow instructions based on Host Override or not?
  • If I have a server already in production with a custom domain name, eg. app.example.com, how should I switch around?
  • For a an app that is not in production, should I point the Backendless app to a custom domain at any time, or not? Eg. the app.example.com name as mentioned above. (answer is No, after watching Marks youtube video more closely.)

Any feedback here would be helpful.

We have not tested it with CloudFront. I think it is extremely unlikely that it won’t work.

It is entirely up to you if you use host override or not. If you do, make sure the CDN uses your xxxx.backendless.app subdomain as the host. Otherwise, ensure your custom domain is still registered with Backendless (in Backendless console).

If you already have a custom domain name, create a DNS configuration as required by the CDN so the traffic gets routed through the new DNS mapping.

Regards,
Mark

I need this spoon-fed :smiley:

If I have app.somewhere.com as my custom domain name in Backendless now, and want to continue using that also with a CDN config, my guess is I have to:

  1. Set up the CDN with app.somewhere.com as its custom domain name, pointing towards the xxx.backendless.app domain
  2. Change the CNAME to point towards the CDN as per its config requirements
  3. Downtime for the app while SSL cert is in the making
  4. When new SSL cert is active with CDN, all is golden

Is this about right do you think?

Please ignore my post (now deleted), as it didn’t make sense.

What you describe is correct. That was my experience when I was playing around with Fastly CDN

Regards,
Mark

I seem to have got it working - mostly… However, file resources in the app using the API URL is coming from eu.backendlessappcontent.com instead of xxxx.backendless.app. That is also the prefix used if I use the file selector in UI Builder, but not if I copy a link from the Files section.

I have not set up any custom domain names for this app. Do I need to tweak something on the Backendless side to get this working you think?

Are you talking about the URLs returned for the File Reference column types? If so, the URL in the response will depend on the domain name used in the request. If the request uses eu-api.backendless.com, then the domain for the referenced file will be eu.backendlessappcontent.com.

Yes, those as well, but I was thinking of using the File picker in UI Builder for image elements that are part of the UI, not File References:


And similarly, when fetching and setting images from the file system using the API URL:

Is the way to go then to create a files.whatever.com CDN in addition, and put that in front of eu.backendlessappcontent.com?

Sure, that would work.

HMmm, will it really? No requests goes to files.whatever.com - they all go to eu.backendlessappcontent.com, right?

When I want to cache user generated content also on read, don’t I have to:

  1. Create a custom domain in Backendless, e.g. backendless.whatever.com, and check the radio button for File Repo Access, like this:

  2. When the SSL certificate is enabled, create app.whatever.com as CDN front, pointing towards backendless.whatever.com

Or am I getting this all wrong?

I am confused…


Requests go to where you/your app sends them. If you send them to files.whatever.com, they go there. If that domain is configured at the CDN level to use eu.backendlessappcontent.com as the source, the request will go there to grab the content…


Just do a simple test. Here’s your app’s web directory. Copy the public URL of index.html:

See what the URL looks like (it will use your xxxx.backendless.app subdomain). This tells me that if you use xxxx.backendless.app subdomain to address your files, things will work.

However, nothing stops you from creating and configuring backendless.whatever.com, if that’s how you prefer to handle it.

Hehe, if you are confused Mark, imagine how I look!

:confounded:

I am talking about two scenarios at once, sorry about that. Let me focus on the most important part.

I have an app in production: app.dynamicrelations.no.
It answers to app.dynamicrelations.no for both api requests and file requests, because it has File Repo Access checked in the Custom Domains setup. So, regardless of the server serving API requests or file requests, app.dynamicrelations.no answers them all.

Now, I want to get a CDN in front of this server, and take over answering all requests to app.dynamicrelations.no. How do I do that?

If I remove the CNAME record in Backendless, and point that towards the CDN instead, then API requests will be working just fine I suspect, but Files will then be accessed through eu.backendlessappcontent.com?

That is my worry. :worried:
Unless this is now superclear, I guess I’ll just have to test this out with another server so that I know what will happen…

Hi @Egil_Helland ,

As far as I understand, nothing will change on our end. Backendless will continue to send content as it did before because Backendless is unaware of your CDN settings. Whoever initiated the request will receive the response, and what happens next with that content is beyond our control. It might be worth trying, and if anything unexpected occurs, we can collectively address specific cases.

Regards,
Viktor

I think I just have to test this out, as you suggest Viktor. I’ll do that on a separate site from my production site to make sure that I both understand what is happening, mimic the production setup and the changes needed, and document my steps.