title: S3 Redirection Rules for API Gateway not working
body: <p>I am following <a href="https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/" rel="nofollow noreferrer">this tutorial</a> and create <code>Lambda</code> , <code>API Gateway</code> and <code>S3 bucket</code></p>
  
  <p>Integration of Lambda and Api gateway is done and also logs.
  Issue I face is Api Gaetway is not accessible in S3 bucket.</p>
  
  <p>I enable <code>Use this bucket to host a website</code> in properties and add <code>index.html</code> for index document.</p>
  
  <p>Redirection Rule is</p>
  
  <pre><code>&lt;RoutingRules&gt;
  &lt;RoutingRule&gt;
  &lt;Condition&gt;
    &lt;KeyPrefixEquals/&gt;
    &lt;HttpErrorCodeReturnedEquals&gt;404&lt;/HttpErrorCodeReturnedEquals&gt;
  &lt;/Condition&gt;
  &lt;Redirect&gt;
    &lt;Protocol&gt;https&lt;/Protocol&gt;
    &lt;HostName&gt;xyz.execute-api.ap-south-1.amazonaws.com&lt;/HostName&gt;
    &lt;ReplaceKeyPrefixWith&gt;prod/api&lt;/ReplaceKeyPrefixWith&gt;
    &lt;HttpRedirectCode&gt;307&lt;/HttpRedirectCode&gt;
  &lt;/Redirect&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>When I hit s3 bucket image which not exists there, it should hit this API Gateway and logs in <code>Cloudwatch</code> but it's not happen.</p>
  
  <p>If I hit APIGaetway url directly, it logs</p>