S3 bucket PDF files can't be accessed using virtual hosting style links


Hi there, I have a static website being hosted in an S3 bucket with Route 53 handling redirects to our short URL and everything is working well (I'm able to use relative paths in the HTML for pages, images, CSS etc.) except for with PDF files. For some reason, the PDF files can't be accessed using virtual hosting style links (such as http://www.townepoint.org.s3-website-us-west-2.amazonaws.com/images/newsign3.JPG) and only path style links (such as http://s3.us-west-2.amazonaws.com/www.townepoint.org/TPOA+Commons.pdf) work. This is breaking the ability to reference the files relatively like all of the other files on the site. Using the examples above, http://www.townepoint.org/TPOA+Commons.pdf is not a working URL when http://www.townepoint.org/images/newsign3.JPG does work.

asked 9 months ago104 views
1 Answer

Sure looks like something tricky going on there. I noticed that this works:

aws s3 cp s3://www.townepoint.org/images/newsign3.JPG foo

whereas this gets "fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden":

aws s3 cp s3://www.townepoint.org/TPOA+Commons.pdf foo

So as a first step I'd suggest reviewing bucket permissions and making sure that both the above work OK for other users.

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions