By "GET data," it sounds like you are referring to the query string -- e.g. ?foo=1&bar=2
-- that follows the path in your URL. This is removed by S3 when you do object-level redirects.
Instead of redirecting specific objects, you can use routing rules to redirect requests for all objects with a specific prefix to a different web site, and optionally you can do this redirect only if an error (such as 404) would occur while trying to serve the original object. Using this method, the query string seems to be consistently preserved.
To redirect every nonexistent object at http://example.com/this/directory/*
to http://other-site.example.com/that/directory/*
you'd use a rule something like this:
<RoutingRule>
<Condition>
<KeyPrefixEquals>this/directory/</KeyPrefixEquals>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>http</Protocol>
<HostName>other-site.example.com</HostName>
<ReplaceKeyPrefixWith>that/directory/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
<HttpErrorCodeReturnedEquals>
is not required if you want to redirect every object request matching that prefix to the other site, even when the object already exists in the bucket where the rule is configured. <ReplaceKeyPrefixWith>
could be set to the same values as <KeyPrefixEquals>
or possibly omitted entirely, if you don't need to rewrite the path prefix.
Note that you don't use a leading slash in the prefix-related options.
Note also that the correct value you'll want to use for <HttpErrorCodeReturnedEquals>
may be 403 ("Forbidden") instead of 404 ("Not Found"). Objects in S3 can be made public by either bucket-level or object-level permissions. If the bucket itself is not publicly-readable, the objects still can be, if their permissions are set individually. When the bucket itself is not publicly-readable, (iirc) S3 will not acknowledge whether the object exists or not, with a 404 on an unauthenticated request, and will instead generate the 403 error, so that's the error you'll need to trap in the redirect rules.