Skip to content

Commit 589b052

Browse files
committed
Reflect node v8 and no need for setting host
1 parent 5fdf401 commit 589b052

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,19 @@ Note, you **will not be creating** a CloudFront "custom error response" that red
5353

5454
#### 3. Install Dependencies
5555

56-
( Node v6, yarn >= v1.1.0 ) (note, yarn before v1.1.0 has a bug that causes dev deps to be installed)
56+
( Node v8, yarn >= v1.1.0 ) (note, yarn before v1.1.0 has a bug that causes dev deps to be installed)
5757

5858
`$ yarn install`
5959

6060
#### 4. Hardcode your prerender.cloud auth token
6161

6262
Edit [handler.js](handler.js) and set your prerender.cloud API token (cmd+f for `prerenderToken`)
6363

64-
#### 5. Hardcode your CloudFront URL
64+
#### 5. Edit any other configs (optional)
6565

66-
Edit [handler.js](handler.js) and set your CLoudFront distribution URL or whatever domain is aliased to your CloudFront distribution (cmd+f for `host`).
66+
e.g. `botsOnly`, `removeTrailingSlash` in [handler.js](handler.js)
6767

68-
If you don't set this, the Lambda@Edge will see the host as the S3 origin, which means that's what prerender.cloud will attempt to hit which means you'd need to configure your s3 origin to be publicly accessible. Plus, it's usually better for prerender.cloud to prerender against the canonical URL, not the S3 origin.
69-
70-
#### 6. Edit any other configs (optional)
71-
72-
e.g. `botsOnly`, `removeTrailingSlash`
73-
74-
#### 7. Remove CloudFront custom error response for 404->index.html
68+
#### 6. Remove CloudFront custom error response for 404->index.html
7569

7670
**(this step is only necessary if you are using an existing CloudFront distribution)**
7771

@@ -85,7 +79,7 @@ It has to be removed because it prevents the execution of the viewer-request fun
8579
4. make note of the TTL settings (in case you need to re-create it)
8680
5. and delete the custom error response (because having the custom error response prevents the `viewer-request` function from executing).
8781

88-
#### 8. Add `s3:ListBucket` permission to CloudFront user
82+
#### 7. Add `s3:ListBucket` permission to CloudFront user
8983

9084
**(this step is only necessary if you want 404s to work)**
9185

@@ -112,22 +106,22 @@ If you're not editing an IAM policy specifically, the UI/UX checkbox for this in
112106

113107
You can modify the content of the 404 page in [handler.js](handler.js)
114108

115-
#### 9. Lambda@Edge function Deployment (only needs to be done once)
109+
#### 8. Lambda@Edge function Deployment (only needs to be done once, or whenever you `git pull` from this repo)
116110

117111
1. Make sure there's a "default" section in your ~/.aws/credentials file with aws_access_key_id/aws_secret_access_key that have any of the following permissions: (full root, or see [serverless discussion](https://github.com/serverless/serverless/issues/1439) or you can use the following policies, which are _almost_ root: [AWSLambdaFullAccess, AwsElasticBeanstalkFullAccess])
118112
2. now run: `$ CLOUDFRONT_DISTRIBUTION_ID=whateverYourDistributionIdIs make deploy`
119113
3. See the created Lambda function in Lambda: https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions
120114
4. See the created Lambda function in CloudFront: (refresh it, click your distribution, then the behaviors tab, then the checkbox + edit button for the first item in the list, then scroll to bottom of that page to see "Lambda Function Associations")
121115

122-
#### 10. Deployment (of your single-page application)
116+
#### 9. Deployment (of your single-page application)
123117

124118
1. sync/push the files to s3
125119
2. invalidate CloudFront
126120
3. you're done (no need to deploy the Lambda@Edge function after this initial setup)
127121

128122
caveat: note that prerender.cloud has a 5-minute server cache that you can disable, see `disableServerCache` in [handler.js](/handler.js)
129123

130-
#### 11. You're done!
124+
#### 10. You're done!
131125

132126
Visit a URL associated with your CloudFront distribution. **It will take a few seconds** for the first request (because it is pre-rendered on the first request). If for some reason the pre-render request fails or times out, the non-pre-rendered request will be cached.
133127

0 commit comments

Comments
 (0)