spring-cloud-gateway マイクロサービス API ゲートウェイ構成クロスドメイン

@Bean 
public CorsWebFilter corsWebFilter(){ 
    System.out.println("enter...."); 
    org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource ソース = new UrlBasedCorsConfigurationSource(); 

    CorsConfiguration corsConfiguration = new CorsConfiguration(); 

    //1、構成全域
    corsConfiguration.addAllowedHeader("*"); 
    corsConfiguration.addAllowedMethod("*"); 
    corsConfiguration.addAllowedOrigin("*"); 
    corsConfiguration.setAllowCredentials(true); 

    source.registerCorsConfiguration("/**",corsConfiguration); 
    新しい CorsWebFilter(ソース) を返します。
}

おすすめ

転載: blog.csdn.net/qq_20314141/article/details/129845554
おすすめ