coralproject / ask

A better way for journalists to manage forms, submissions, and galleries. Because journalism needs everyone.
https://coralproject.net/products/ask.html
Other
42 stars 8 forks source link

Internal docs links not working #76

Closed kgardnr closed 8 years ago

davidgljay commented 8 years ago

Apparently this is caused by this issue in AWS Cloudfront:

http://stackoverflow.com/questions/31017105/how-do-you-set-a-default-root-object-for-subdirectories-for-a-statically-hosted

For some reason, Cloudfront sternly refuses to support these sorts of links. There's a workaround, but it doesn't seem to be working as advertised. I'm continuing to tinker with it, hopefully the issue will be resolved soon.

davidgljay commented 8 years ago

Continuing to tinker with cloudfront settings, once I have this sorted out I'll document.

davidgljay commented 8 years ago

Resolved!

Here's what happened:

By default Cloudfront doesn't support a default object for subdirectories in S3 (it doesn't load index.html when you visit a subdirectory.) Based on the way that it's documented, AWS seems to consider this a feature (??).

There's a workaround, which is to set the Cloudfront origin to the URL of the website generated by S3 rather than to the S3 bucket itself. (e.g. http://coralproject-docs.s3-website-us-east-1.amazonaws.com).

TLDR: If you create a Cloudfront districution, enter the URL of the S3 bucket's public site rather than using the dropdown to select the bucket.

If you need to fix an existing Cloudfront distribution, follow these steps.

  1. Go to the CloudFront control panel.
  2. Click on the Cloudfront distribution you with to edit and click "Distribution Settings".
  3. Click the "Origins" tab.
  4. Add an origin with the URL of your S3 bucket website.
  5. Click the "Behaviors" tab.
  6. Add a Behavior to direct path pattern * to the origin you just created and save.
  7. Wait 10ish minutes (until "Distribution Status" on the main distribution screen is listed as "Deployed".)