0

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?

user19642323
  • 101
  • 1

1 Answers1

0

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

user19642323
  • 101
  • 1