Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Marvin K. Mooney
Jan 2, 2008

poop ship
destroyer
Hey I'm fuckin dumb and have no idea what I messed up, hopefully this is the right place to ask questions.
I'm making a test site using CloudFront/S3 and I can't get them to cooperate. I have my simple site data in an S3 bucket, I made sure to enable static website hosting, and I made sure to enable read permissions
code:
{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "AddPerm",
			"Effect": "Allow",
			"Principal": "*",
			"Action": "s3:GetObject",
			"Resource": "arn:aws:s3:::fart-bucket-content/*"
		}
	]
}
On the CloudFront side, I have a distribution with the origin
code:
fart-bucket-content.s3.amazonaws.com
, origin path blank, bucket access not restricted, default behavior is just "redirect HTTP to HTTPS" "GET, HEAD" everything else is default except I set compress objects to yes.
The issue I'm having is it seems to load up the main page fine, but when it accesses any directories in the fart bucket it comes back with Access Denied, even if there's nothing in the directory but an index.html file. What is going on? Is it a path problem? I tried appending /* to the origin path but then it wouldn't even load the main page. Sorry if this is a dumb question, I'm teaching myself as I go and it's a lot of trial and error.

Adbot
ADBOT LOVES YOU

Marvin K. Mooney
Jan 2, 2008

poop ship
destroyer
So I know the S3 is fine because using the S3 URLs everything works as expected. It must be something with the CloudFront setup. Basically the site is totally barebones: an index.html for the homepage, then an "about" directory and a "contact" directory, each with an index.html file inside. Right now CloudFront can access the main page fine but gives Access Denied errors for everything else. https://www.fartexample.com works, https://www.fartexample.com/contact/ doesn't work, https://www.fartexample.com/contact/index.html doesn't work.

I'll try posting in the AWS forum too but I've tried changing every little setting one at a time and waiting for the full deployment and nothing seems to do anything.

Marvin K. Mooney
Jan 2, 2008

poop ship
destroyer
I figured it out, posting the answer in case anyone else has the same problem.
Turns out I was using the default S3 bucket naming convention that popped up in the CloudFront Origin settings, but that disables the normal behavior where it looks for index.html inside directories. By changing that to the full S3 bucket name found under "Static Web Hosting" in the S3 control panel, it fixed the forwarding and it works normally now.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply