amazon-web-services - AWS Elastic Beanstalk 中的 URL 重写或重定向(使用 Spring Boot 应用程序)
问题描述
我有一个托管在 AWS Elastic Beanstack 上的 Spring Boot 应用程序。
在我的应用程序属性中:
server.servlet.context-path=/PartToRemove
所以我所有的网址都是:
https://example.com/PartToRemove/path/to/the/particlar/endpoint
现在我想删除PartToRemove
to have:
https://example.com/path/to/the/particlar/endpoint
在 Spring Boot 级别很容易 - 我只需要删除行
server.servlet.context-path=/PartToRemove
从我的配置。
但
...我想为所有只知道旧 URL 的用户保持“向后兼容性”。所以我正在考虑设置一些从旧URLhttps://example.com/PartToRemove/path/to/the/particlar/endpoint
到新https://example.com/path/to/the/particlar/endpoint
URL 的重写或重定向。
我对 AWS 不是很熟悉,所以我不确定在哪里执行此操作。我正在考虑 .htaccess 文件中的 mod_rewrite 之类的东西,但我不知道这是否是正确的方法。
我将应用程序部署为 zip 文件,因此.ebextensions
如果有帮助,我可以使用。
关于如何实现这种重定向或重写的任何想法?
解决方案
推荐阅读
- cypress - nx monorepo:在 cypress runner 中显示堆栈跟踪
- r - R getURL 错误:1407742E:SSL 尝试下载 URI
- visual-studio-2019 - 使用 VS2019 将 Web 应用程序部署到 IIS 失败 - DLL 被锁定
- postgresql - 通过nodeJS连接aws postgres实例时出现超时错误
- python - Numpy:对于列表中的每个数组,np.array 的每一行乘以 (1/2)^k
- angular - 将类添加到 div 取决于数组项的值
- r - 产生方差分析的限制方法 - 设置为零与总和为零
- php - 在 Wordpress 用户注册上将用户电子邮件设为小写
- sql - 将 VB6 应用程序连接到 SQL Azure 数据存储
- node.js - 在 jenkinsfile 中安装 nodejs