angular - 如何在 AWS API Gateway 上为 Angular 推送状态路由添加重写规则
问题描述
在Angular Server Configuration 部分,您可以阅读有关如何为不同的服务器设置(例如 IIS(我已经成功完成))配置回退/url 重写到 index.html 的信息。
我正在互联网上搜索(到目前为止没有任何成功)寻找类似的解决方案,但适用于 AWS API Gateway。有没有人知道如何在该技术堆栈中进行 url 重写?即我想让 url 重写类似于这个(对于 IIS)但对于 AWS API Gateway:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="./index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
解决方案
推荐阅读
- amazon-s3 - 两个静态网站 S3 之间基于路径的路由
- linux - Linux文本文件处理——加入虚线
- java - 如何更新数组?
- grep - 如何使用 Ansible 搜索包含特定文本的文件?
- django - Django Rest Framework 资源不响应带有无效令牌的请求
- android - Android 依赖 'com.android.support:recyclerview-v7' 有不同版本的编译(22.1.1)和运行时(27.1.0)类路径
- oracle-jet - Oracle JET 支持的最旧浏览器版本是什么?
- c# - 自托管OWIN项目;http://localhost:8080 不行,http://+:8080 行吗?
- sockets - 减少 TCP 套接字连接重试次数的不良影响
- javascript - 在 iframe 模式对话框中保持焦点