mdn / stumptown-deployer

🚢 those static Stumptown sites
Mozilla Public License 2.0
3 stars 6 forks source link

The right URL suffix behavior #7

Open peterbe opened 5 years ago

peterbe commented 5 years ago

Let's assume that the ideal URL suffix behavior to mimic how it's already working on MDN, which actually looks pretty neat. With one exception.

It's conceivable that a user might type all 3 of these:

  1. DOMAIN/en-US/docs/Web/HTML/Element/video
  2. DOMAIN/en-US/docs/Web/HTML/Element/video/
  3. DOMAIN/en-US/docs/Web/HTML/Element/video/index.html

This is what MDN currently does:

  1. DOMAIN/en-US/docs/Web/HTML/Element/video -- 200
  2. DOMAIN/en-US/docs/Web/HTML/Element/video/ -- 301 to DOMAIN/en-US/docs/Web/HTML/Element/video
  3. DOMAIN/en-US/docs/Web/HTML/Element/video/index.html -- 404

Since MDN is currently not a static site, it doesn't really make sense to support index.html but if we move towards static site hosting, it's inevitable that users will try to type it in and doing a redirect is possible if figured out once, will last for life.

So, the desired end goal is:

  1. DOMAIN/en-US/docs/Web/HTML/Element/video -- 200
  2. DOMAIN/en-US/docs/Web/HTML/Element/video/ -- 301 to DOMAIN/en-US/docs/Web/HTML/Element/video
  3. DOMAIN/en-US/docs/Web/HTML/Element/video/index.html -- 301 to DOMAIN/en-US/docs/Web/HTML/Element/video
peterbe commented 5 years ago

I skimmed this post: https://forums.aws.amazon.com/thread.jspa?threadID=168000

The poster is, like us, very particular about remaining consistent with existing URLs and getting the redirects just right.

That poster figured out to get it to work, he/she created a "folder" called state, and in it, a index.html that redirects to /state. And then he/she created a "file" called state (yes, same name as the folder previously created) and made sure this file has ContentType: text/html.

peterbe commented 5 years ago

@escattone Do you know, is this something we have to worry about on the CloudFront side or it entirely an S3 website hosting problem?