Score:0

Deploying a Serverless site behind CloudFront

cr flag

I use Serverless to deploy a website to an AWS Lambda. This works fine. I now want to use CloudFront to proxy access to this Lambda and cache requests for static files.

I have set up a CloudFront distribution, and created an origin with the origin domain name set to that of the Lambda API gateway, i.e. foobarbaz123.execute-api.eu-west-2.amazonaws.com (note: I can access the static files if I visit this URL directly). I was hoping that this would now allow me to access the static site that the Lambda serves through the CloudFront domain, i.e. abcdefg123.cloudfront.net. However, I recieve a 403 forbidden error when I attempt this.

The origin's settings are pretty much the defaults, save for 'HTTPS only'. I have not touched the Lambda or its S3 bucket since deploying it with sls deploy.

What could I be doing wrong?

Score:0
cr flag

Quickly found the solution: I had forgotten to set up a behaviour using my new origin. This allowed access through CloudFront with no problems.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.