Skip to content

Commit 60b119d

Browse files
committed
Merge pull request #42 from ember-cli-deploy/update-readme-to-include-cors-config
[DOC] add CORS example, fixes #22
2 parents 8710952 + d7ab61a commit 60b119d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ The following properties are expected to be present on the deployment `context`
159159
- `gzippedFiles` (provided by [ember-cli-deploy-gzip][3])
160160
- `manifestPath` (provided by [ember-cli-deploy-manifest][4])
161161

162-
## Minimum S3 Permissions
162+
## Configuring Amazon S3
163+
164+
### Minimum S3 Permissions
163165

164166
Ensure you have the minimum required permissions configured for the user (accessKeyId). A bare minimum policy should have the following permissions:
165167

@@ -184,6 +186,25 @@ Ensure you have the minimum required permissions configured for the user (access
184186
```
185187
Replace <your-s3-bucket-name> with the name of the actual bucket you are deploying to. Also, remember that "PutObject" permission will effectively overwrite any existing files with the same name unless you use a fingerprinting or a manifest plugin.
186188

189+
### Sample CORS configuration
190+
191+
To properly serve certain assets (i.e. webfonts) a basic CORS configuration is needed
192+
193+
```
194+
<?xml version="1.0" encoding="UTF-8"?>
195+
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
196+
<CORSRule>
197+
<AllowedOrigin>http://www.your-site.com</AllowedOrigin>
198+
<AllowedOrigin>https://www.your-site.com</AllowedOrigin>
199+
<AllowedMethod>GET</AllowedMethod>
200+
<AllowedMethod>HEAD</AllowedMethod>
201+
</CORSRule>
202+
</CORSConfiguration>
203+
```
204+
205+
Replace **http://www.your-site.com** with your domain.
206+
207+
Some more info: [Amazon CORS guide][6], [Stackoverflow][7]
187208

188209

189210
## Running Tests
@@ -195,3 +216,5 @@ Replace <your-s3-bucket-name> with the name of the actual bucket you are deployi
195216
[3]: https://github.com/lukemelia/ember-cli-deploy-gzip "ember-cli-deploy-gzip"
196217
[4]: https://github.com/lukemelia/ember-cli-deploy-manifest "ember-cli-deploy-manifest"
197218
[5]: https://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_AWS_Credentials "Setting AWS Credentials"
219+
[6]: http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html "Amazon CORS guide"
220+
[7]: http://stackoverflow.com/questions/12229844/amazon-s3-cors-cross-origin-resource-sharing-and-firefox-cross-domain-font-loa?answertab=votes#tab-top "Stackoverflow"

0 commit comments

Comments
 (0)