Skip to content

Instantly share code, notes, and snippets.

@danshultz
Created March 1, 2015 21:13
Show Gist options
  • Save danshultz/2779388d2651c40191e7 to your computer and use it in GitHub Desktop.
Save danshultz/2779388d2651c40191e7 to your computer and use it in GitHub Desktop.
Hosting Ember App on S3
  1. Use ember-deploy + ember-deploy-s3 + ember-deploy-s3-index
  2. npm install --save-dev ember-deploy ember-deploy-s3 ember-deploy-s3-index
  3. Update nginx with the following config
server {
  listen 80;
  server_name foo.example.dev;
  location / {
    set $s3_bucket 'my-ember-app-index.s3.amazonaws.com';
    set $url_full         '$1';

    proxy_http_version     1.1;
    proxy_set_header       Host $s3_bucket;
    proxy_set_header       Authorization '';
    proxy_hide_header      x-amz-id-2;
    proxy_hide_header      x-amz-request-id;
    proxy_hide_header      Set-Cookie;
    proxy_ignore_headers   "Set-Cookie";
    proxy_buffering        off;
    proxy_intercept_errors on;

    # AWS NS Resolver 172.16.0.23 instead of Google's one 8.8.8.8
    resolver        8.8.8.8; # OpenDNS
    #resolver        172.16.0.23; # Use this on AWS
    resolver_timeout       5s;

    set $index 'index.html';
    if ($arg_app_ref) { set $index '<ember-manifest>:$arg_app_ref.html'; }

    proxy_pass             http://$s3_bucket/index.html;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment