首页 > 解决方案 > 在子路径上运行后,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,注销也一样

标签: spring-bootfreemarker

解决方案


推荐阅读