spring-boot - 在子路径上运行后,Spring Boot App 不再正常工作
问题描述
我有一个在服务器的根路径上运行的应用程序,但我们的客户端现在希望从子路径上的另一个域访问它。
internal url: app.xyz.com
client domain: otherapp-com/maintenance/
所有来自的请求otherapp-com/maintenance/
都由某个代理转发到app.xyz.com
该应用程序使用 freemarker 并且一切看起来都很好app.xyz.com
,但在otherapp-com/maintenance/
UI 上因为无法找到 CSS 和 js 文件而损坏。在 chrome 中,我看到请求去了,otherapp-com/js/...
但它们位于otherapp-com/maintenance/js/..
我怎样才能解决这个问题?
在 Freemarker 模板中,我导入这样的脚本
<script src="js/datatables/1.10.19/jquery.dataTables.min.js"></script>
我在登录和注销 URL 的 Spring Security Setting 中遇到了同样的问题
当前配置是
//HttpSecurity http
http.authorizeRequests()
...
.loginPage("/login")
.failureUrl("/login?error")
.defaultSuccessUrl("/")
.permitAll()
.and()
.logout()
.logoutUrl("logout")
.logoutSuccessUrl("/")
.permitAll();
登录也转到otherapp-com/login
不登录otherapp-com/maintenance/login
,注销也一样
解决方案
推荐阅读
- c# - 在 asp.net core MVC 中显示控制器视图时出错
- python - boto3 describe_fleets api 未获取所有车队信息
- apache-flink - Flink 保存点每次都从头开始重新启动我的一次性源(S3 和 Kinesis)
- python - 计算由字符串的混合值和字符串列表组成的 pandas 数据框列中的唯一值
- javascript - 使用 moment.js 将今天的时间添加到明天的日期 js
- sql - 如何验证按下提交按钮时为空的交互式网格
- webpack - 如何强制 webpack 为资源生成动态 publicPath
- regex - 为匹配特定模式的字符串添加前缀
- php - 我如何使用@ManyToMany Symfony4 持久化数据
- docker - 在创建 docker 容器时,我应该更喜欢在 Dockerfile 中定义安装,还是应该添加一个从 DockerFile 调用的脚本?