How can i add a redirection rule to my bucket

I want to add a redirection rule like i did at s3 below;

`
To set up the S3 redirection rule

In the S3 console, open the bucket that you created above.
Expand Static Website Hosting, Edit Redirection Rules.
Replace YOUR_API_HOSTNAME_HERE with the hostname that you noted above and copy the following into the redirection rules configuration:`
<RoutingRules>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals/>
            <HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
        </Condition>
        <Redirect>
            <Protocol>https</Protocol>
            <HostName>__YOUR_API_HOSTNAME_HERE__</HostName>
            <ReplaceKeyPrefixWith>prod/resize?key=</ReplaceKeyPrefixWith>
            <HttpRedirectCode>307</HttpRedirectCode>
        </Redirect>
    </RoutingRule>
</RoutingRules>

3 Replies

Hey @zebramo_murat - I checked in with our Object Storage team about this, and redirects aren't currently supported.

What you are able to do, however, is specify a custom 404 page when creating a static site with Object Storage. To do this using s3cmd, you would use the following:

--ws-error=404.html

Hopefully this helps with what you're looking to do. If you're trying to achieve something else, let us know so that we can pass along the feedback!

Thanks for reply but its not what i looking for. I need an interface to reply client with redirection status code (307) not 404.

Hi, I know this is old. I just found it here since I was trying to configure my Object Storage Bucket on Linode, which is working fine now.

I already created a custom 404.html, uploaded it to the bucket.
Then I used the s3cmd command to serve that page (--ws-error=404.html) Now that 404 page loads fine if I call it via URL browser.

I use NGINX on my webserver (which is connected to the bucket).
How can I make all the "AccessDenied" pages that appear when someone request non-existent objects or paths on my bucket to be redirected automatically to this generic error 404.html page ?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct