javascript - Spring WebSecurityConfig 有问题 antMatchers 访问有 IpAddress
问题描述
http.cors().and().csrf().disable();
http.authorizeRequests().antMatchers("/api/**").access("hasIpAddress('Specific ip')");
http.formLogin().permitAll();
http.exceptionHandling() .accessDeniedPage("/denied");
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED);
http.headers().frameOptions().disable();
在网络浏览器上测试时效果很好。某些 ip 限制是可能的,但在移动网络上,当通过 Wi-Fi 连接时,它运行良好,但当通过数据连接时,/api 无法正常运行。如何解决?
解决方案
推荐阅读
- javascript - 如何为所选选项制作菜单列表?
- python - 使用就地面具的工作方式是否不同?
- swift - 与 API 交互时的 keyNotFound CodingKeys
- c++ - 我尝试使用 matlab 创建被动电池平衡,但我的电池 4 中的充电状态无法平衡
- android - ActivityRetainedLifecycle.OnClearedListener 应该如何使用?
- javascript - koajs:如何等待客户端接收文件?
- python - sklearn train_test_split 运行两次报错
- reactjs - 在 reactstrap popover 正文中使用锚标签不起作用
- javascript - 将未知数量的参数传递给 HTML onclick 事件属性
- javascript - 以编程方式在 html 页面中添加 javascript