AWS S3 404 using the Ember app using history location

How do I tell AWS S3 for service index.htmlfor all pages, not just /? It currently returns 404 if I enter the application in any subroutine. I am using historylocation.

I tried redirecting with this rule:

<RoutingRules>
  <RoutingRule>
    <Condition>
    <HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals >
     </Condition>
    <Redirect>
      <HostName>yourdomainname.com</HostName>
    </Redirect>
  </RoutingRule>
</RoutingRules>

This ends with a redirect loop.

And I tried to set the document with the error on index.html. It is not able to load static assets then because it tries to find them at the url that was requested, and not the actual root URL.

+4
source share
2 answers

, , , , , .

ember 'history' location hash, .

<RoutingRules>
    <RoutingRule>
        <Condition>
            <HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals>
        </Condition>
        <Redirect>
            <HostName>bucketname-website-us-east-1.amazonaws.com</HostName>
            <ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>
        </Redirect>
    </RoutingRule>
</RoutingRules>

. URL- , .

+1

index.html,

-1

Source: https://habr.com/ru/post/1526031/


All Articles