java - Springboot 不会重定向到 nginx 上的论坛
问题描述
我在 Nginx 网络服务器上安装了一个论坛,并且我在同一台服务器上运行了 springboot,但我使用 nginx 作为代理,所以效果很好,问题是我在名为 forums 的 nginx 网站文件夹中安装了论坛,我添加了 / forums/ 到 spring boot security 但是当我去 url/forums/ 我得到一个 spring security 阻止我进入页面?
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requiresChannel().anyRequest().requiresSecure();
http.cors().and().csrf().disable();
http
.authorizeRequests()
.antMatchers("/", "/rest", "/js/**", "/images/**", "/css/**", "/assets/**", "/login", "/register", "/font/**", "/fonts/**", "/sitemap.xml", "/hiscores", "/rest/players/get/**", "/rest/players/update/**",
"/rest/players/login/**", "/rest/**", "/pp/api/success", "/pay", "/pay/success", "/pay/cancel", "/classes", "/master/**", "/vendor/**", "/videos/**", "/img/**", "/forums/**", "/forums", "/download/", "/rest/version/", "/rest/changelog/").permitAll()
.anyRequest().authenticated()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/dashboard/logout")).logoutSuccessUrl("/");
}
它应该允许我去 /forums/ 的 url
编辑:
Path /forums
Error Not Found
Status 404
Message No message available
论坛控制器
@RestController
public class ForumsController {
@RequestMapping(value = "/forums/", method = RequestMethod.GET)
public ModelAndView showDashboard(ModelAndView modelAndView) {
modelAndView.setViewName("redirect:/forums");
return modelAndView;
}
}
解决方案
推荐阅读
- java - 如何为 spring-kafka 创建的所有 MessageListenerContainers 设置 RecordInterceptor
- c - 当宏将值存储在自己的参数中时,这意味着什么?
- react-select - 使用 react-hook-form 进行反应选择
- ios - 我应该在ios的日记应用中使用什么类型的数据库?
- microservices - 如何在微服务架构中实现从多个服务中检索数据的查询?
- c# - 打开 Unity 项目时,卡在导入上
- github - 从 Cake 的 GitHub Pull Requests 访问目标分支名称
- r - 列标题包含示例信息我如何将它们分成 R 中的两列
- angular - DevExtreme 选项卡面板已禁用仍处于活动状态
- sql - 如何查看sql server中的变量值