سؤال

Let's say I want all requests to https://example.com/api/users/1 redirected to http://api.example.com/users/1 using a AWS S3 bucket.

So all requests to the "directory" api should be redirected to the subdomain api.example.com

Can somebody provide a RoutingRule for that?

هل كانت مفيدة؟

المحلول

Here is the RoutingRule I ended up with:

<RoutingRules>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>api/</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <HostName>api.example.com</HostName>
            <ReplaceKeyPrefixWith/>
        </Redirect>
    </RoutingRule>
</RoutingRules>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top