Skip to content

Commit

Permalink
remove corsFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
wubinTron committed Feb 27, 2020
1 parent 4b8bf51 commit a3915f8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/java/org/tron/trongeventquery/TronEventApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,21 @@ public static void main(String[] args) {
SpringApplication.run(TronEventApplication.class, args);
shutdown();
}


@Bean
public FilterRegistrationBean corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
bean.setOrder(0);
return bean;
}

@Bean
public MongoTemplate mongoTemplate(
@Value("${mongo.host}")String mongodbIp, @Value("${mongo.dbname}")String mongodbDbName,
Expand Down

0 comments on commit a3915f8

Please sign in to comment.