Moh*_*224 6 amazon-s3 amazon-cloudfront angular angular8 angular9
我使用 S3 和 CloudFront 服务在 AWS 中托管我的 Angular 9 应用程序。访问应用程序后,我在浏览器中收到以下错误:
\n我的index.html:
\n<!doctype html>\n<html>\n<head> \n <meta charset="utf-8">\n <title>ReachApp Success</title>\n <base href="/reach">\n <!-- TODo: check for common configuration for material icon -->\n <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> \n <meta name="viewport" content="width=device-width, initial-scale=1">\n <link rel="icon" type="image/x-icon" href="favicon.ico">\n <script src='https://www.google.com/recaptcha/api.js' async\xc2\xa0defer></script> \n<link rel="stylesheet" href="styles.7f06624db32e037ad1c6.css"></head>\n<body>\n <reach-root></reach-root>\n <div id="displayError"></div> <!-- Display message if IE broswer-->\n<script src="runtime-es2015.0dae8cbc97194c7caed4.js" type="module"></script><script src="runtime-es5.0dae8cbc97194c7caed4.js" nomodule defer></script><script src="polyfills-es5.352c85d9e468300d10fb.js" nomodule defer></script><script src="polyfills-es2015.27bdbf82a4d61d823e83.js" type="module"></script><script src="main-es2015.89b57a9808d25011d96d.js" type="module"></script><script src="main-es5.89b57a9808d25011d96d.js" nomodule defer></script></body>\n</html>\nRun Code Online (Sandbox Code Playgroud)\n我已经尝试了其他人提供的不同建议,将 type="module" 替换为 type="text/javascript" 但仍然没有成功。\n有人可以建议任何可能的解决方案来解决此问题吗?
\n浏览完所有评论后,此问题最可能的原因如下
\n查看
\nredirect选项卡。确保将错误页面(403)重定向到带有200响应的index.html有关 BASE_HREF 的更多信息
\n--base-href\n如果将 Angular 应用程序部署到子文件夹,则 \xe2\x80\x98 --base-href\xe2\x80\x99 对于生成正确的路由非常重要。该参数将更新index.html 内的标签。
\n例如,如果 index.html 位于服务器上的 /angularapp/index.html,则基本 href 应设置为 。
\n更多信息: https: //angular.io/guide/deployment
\nng build --prod --base-href /angularapp/\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4218 次 |
| 最近记录: |