title: How do I set up an AWS S3 Object Redirect via the Java SDK
body: <p>I'm asking this question in order to answer it and point others in the right direction faster then I got there. </p>
  
  <p>I spent far too long looking for the answer as most S3 Object Redirection questions and their answers had to do with the technical detail of confusing the S3 bucket access point for the S3 website access point. </p>
  
  <p>What, there's a different url? </p>
  
  <p>Yes -- See: <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html</a>  </p>
  
  <p>Once you get past that the natural path seems to be trying to use ObjectMetaData to set at least one of: </p>
  
  <pre><code>x-amz-website-redirect-location
  x-amz-user-website-redirect-location
  website-redirect-location
  </code></pre>
  
  <p>None of which actually work even though the API will silently change these to <code>website-redirect-location</code> when you go check the meta-data through the S3 admin portal. </p>
  
  <p>Of course an S3 Object's meta data can be easily edited, via the portal, to change the key to <code>Website-Redirect-Location</code> and the redirect instantly starts working, tricking one into thinking that you've almost got it right... </p>
  
  <p>The next "obvious" place is to see if there is another method, similar to  the methods <code>.setContentLength</code> or <code>.setContentType</code> on ObjectMetaData </p>
  
  <p>Nope that's not it either. </p>