- Más nuevo
- Más votos
- Más comentarios
Based on your description, there are several potential causes for the 403 Forbidden error you're experiencing with your S3 static site:
-
Conflicting Configuration: You appear to be using both static website hosting and CloudFront with Origin Access Identity (OAI). These two approaches don't work well together. When using OAI/OAC (Origin Access Control), you should not have static website hosting enabled on the bucket.
-
Block Public Access Settings: If you're trying to make your S3 content publicly accessible, you need to disable the "Block all public access" settings under the bucket's Permissions section. However, if you're using CloudFront with OAI (which is more secure), the bucket should remain private.
-
Origin Configuration Issue: Your CloudFront distribution might be pointing to the S3 website endpoint instead of the S3 REST API endpoint. When using OAI/OAC, your origin should be the S3 bucket REST endpoint (e.g.,
bucket-name.s3.amazonaws.com). -
Default Root Object: Make sure you've set
index.htmlas the default root object in your CloudFront distribution settings.
To resolve this issue, you have two main options:
Option 1 (Recommended for security): Use CloudFront with OAI/OAC
- Keep your S3 bucket private (Block all public access ON)
- Disable static website hosting
- Configure CloudFront to use the S3 REST API endpoint
- Ensure your bucket policy grants the CloudFront service principal access to your objects
- Set
index.htmlas the default root object in CloudFront
Option 2: Use S3 static website hosting directly
- Turn off "Block all public access" settings
- Enable static website hosting
- Add a bucket policy that allows public read access to your objects
If you're using CloudFront with OAI, verify that your bucket policy correctly includes the CloudFront service principal and the appropriate condition for your distribution.
Sources
Among us mod apk always imposter - S3 static site returning 403 Forbidden? | AWS re:Post
php create createBucket and to Allow Public Read Object | AWS re:Post
Configuring block public access settings for your S3 buckets - Amazon Simple Storage Service
Contenido relevante
- preguntada hace 4 meses
- preguntada hace 8 meses
- preguntada hace 7 meses
- OFICIAL DE AWSActualizada hace 2 meses
