Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discussion of defining redirect on S3 static website #8

Open
smalers opened this issue Jan 5, 2022 · 1 comment
Open

Add discussion of defining redirect on S3 static website #8

smalers opened this issue Jan 5, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request high Priority: next release if possible XS Size: 2 hours or less

Comments

@smalers
Copy link
Contributor

smalers commented Jan 5, 2022

There are some websites like https://poudre.openwaterfoundation.org that are a general URL that needs to redirect to a specific version such as latest. This can be implemented on the S3 static website bucket. A documented example needs to be added.

@smalers smalers added enhancement New feature or request high Priority: next release if possible XS Size: 2 hours or less labels Jan 5, 2022
@smalers smalers self-assigned this Jan 5, 2022
@smalers
Copy link
Contributor Author

smalers commented Jan 5, 2022

Here is content that can be added to the documentation...

This applies to a static website hosted on S3. If CloudFront is used, the redirect may need to be removed if it conflicts with the lambda function's manipulation of the URL.

The https://poudre.openwaterfoundation.org website corresponds to S3 bucket poudre.openwaterfoundation.org. Under that are versioned folders and latest folder containing versions of the website. Anyone that visits the general site URL (without folder) needs to be directed to the URL with the folder https://poudre.openwaterfoundation.org/latest to see the latest version. See the AWS article.

  1. Create a zero-length index.html file on the local computer and upload to the main bucket folder using the AWS console. The purpose of the file is to allow attaching redirect metadata, but it won't have any contents that are displayed on the website.
  2. Click on the file in the S3 console to display its properties.
  3. Select the Object Actions / Edit metadata choice. This will show existing metadata on the object, similar to below.

image

  1. To define a redirect, use the Add metadata button and x-amz-website-redirect-location metadata key with value being the desired URL.

It can be difficult to read the defined metadata properties once defined if the names are long. To view/edit existing metadata, select the Edit metadata button. Then press Configuration. This will show the redirect property as shown below.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high Priority: next release if possible XS Size: 2 hours or less
Projects
None yet
Development

No branches or pull requests

1 participant