James Lee
James Lee

Reputation: 3

React/Vite App: 403 Forbidden Errors with AWS CloudFront

I recently encountered an issue when deploying a React/Vite web application using AWS CodePipeline. While the application runs smoothly in my local development environment, I'm facing a series of "403 Forbidden" errors when the application is deployed to the DEV environment. The error messages look like this:

GET https://test.com/test.css net::ERR_ABORTED 403 (Forbidden)
GET https://test.com/test.js net::ERR_ABORTED 403 (Forbidden)
GET https://test.com/assets/index-495cfc72.css net::ERR_ABORTED 403 (Forbidden)
GET https://test.com/assets/index-67e333eb.js net::ERR_ABORTED 403 (Forbidden)
GET https://test.com/favicon.png 403 (Forbidden)
GET https://test.com/manifest.json 403 (Forbidden)

Thank you for your help!

Upvotes: 0

Views: 1034

Answers (1)

bildungsroman
bildungsroman

Reputation: 473

It's hard to answer precisely without your exact architecture, but the first place I would start would be checking the access permissions on the S3 bucket hosting your files.

  1. Go to S3 in the AWS Console
  2. Find your assets bucket, and under Permissions, disable Block all public access if it's enabled
  3. Under Properties, you can then set Static website hosting settings

Upvotes: -1

Related Questions