Hosting an Ember app in S3 and Cloudfront

Mar 29, 2016 using tags emberjs, s3

Hosting an Ember app on S3 can be slightly challenging since routes (paths) aren’t mapped to actual files and so S3 gets quite confused. Here are a few ways to make this work.

In your Ember app, enable the autolocation feature in app/router/js:

import Ember from 'ember';

// ...

  location: 'auto'

// ...

export default Router;

In your S3 website bucket, set the Redirection Rules to be the following:


The main assumption here is that your Ember app will be served off These changes should kick in whenever your Cloudfront cache expires or an invalidation occurs.

What will happen is that whenever someone goes to, they will get 301 redirected to, which Ember will take and do the right thing.

The extra redirection can be slightly ugly but for some use cases it beats standing up a web server with apache/nginx/etc just to host a static Ember app.