LoginSignup
3
3

More than 3 years have passed since last update.

AWS Amplify ConsoleでSPAのときのリダイレクト設定

Posted at

問題点

SPAサイトをAWS Amplify Consoleで自動デプロイしようとしていたときにブラウザから特定のサイトにアクセスするとき、 403 Access denniedになっていたのでその対策を調べた結果を載せておく

原因

SPAのページ遷移はサーバーリクエストをせずにHTML5のhistory.pushState()で遷移される。そのため、ブラウザからのアクセス(サーバリクエスト)があった場合はindex.htmlに遷移するように設定する必要がある

解決策

Amplifyのメニューのrewrites and redirectsから以下を設定

スクリーンショット 2019-10-01 23.10.04.png

参考

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3