I have successfully configured my S3 bucket to serve a static website and also redirect to a lambda function if a file is not found in the bucket.
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals/>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<HostName>mylambda.execute-api.us-east-1.amazonaws.com</HostName>
<ReplaceKeyPrefixWith>/?key=</ReplaceKeyPrefixWith>
<HttpRedirectCode>307</HttpRedirectCode>
</Redirect>
</RoutingRule>
</RoutingRules>
it works fine if I use the http url of the static website
http://mybucket.s3-website-us-east-1.amazonaws.com/some-file.gif
but it doesn´t work if I use the https bucket url. it returns AccessDenied
https://s3.amazonaws.com/mybucket/some-file.gif
I also tryied adding cloudfront and the issue is the same. https://mycloudfront.cloudfront.net/some-file.gif gives me the same AccessDenied
is like not working for https maybe?