网关程序启动

网关测试路由转发时发现未授权

 在启动类加上这句话

  @Bean
    SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {
        return http.httpBasic().and()
                .csrf().disable()
                .authorizeExchange()
                .anyExchange().permitAll()
                .and()
                .build();
    }

启动成功

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐