Using the Website Redirection Location Feature

When using buckets to host websites, Hedvig supports the Website Redirect Location feature, which shortens a URL, because resources may be located in deep folder structures.

Procedure

  1. Create an empty object directly under a bucket.

  2. Set the value of its metadata key, x-amz-website-redirect-location, to the target object location.

    aws s3api --endpoint http://<hostname>:<port_number> put-object
      --bucket <bucket_name> --key redirect.html
      --website-redirect-location "/f1/f2/../fn/target_image"

    The long URL virtual-hosted style request to get the empty object is then redirected to the target object.

  3. When you put the following in the browser:

    http://<bucket_name>.<hostname>:<port_number>/redirect.html

    You are redirected to:

    http://<bucket_name>.<host_name>:<port_number>/f1/f2/../fn/target_image

Loading...