2017-04-16 17:59:17 +00:00
|
|
|
package ba.steles;
|
|
|
|
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
|
|
|
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
2017-06-01 22:12:09 +00:00
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.web.cors.CorsConfiguration;
|
|
|
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|
|
|
import org.springframework.web.filter.CorsFilter;
|
2017-04-16 17:59:17 +00:00
|
|
|
|
|
|
|
@EnableZuulProxy
|
|
|
|
@EnableEurekaClient
|
|
|
|
@SpringBootApplication
|
|
|
|
public class SteleksProxyApplication {
|
|
|
|
|
2017-06-01 22:12:09 +00:00
|
|
|
@Bean
|
|
|
|
public CorsFilter corsFilter() {
|
|
|
|
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
|
|
|
final CorsConfiguration config = new CorsConfiguration();
|
|
|
|
config.setAllowCredentials(true);
|
|
|
|
config.addAllowedOrigin("*");
|
|
|
|
config.addAllowedHeader("*");
|
|
|
|
config.addAllowedMethod("OPTIONS");
|
|
|
|
config.addAllowedMethod("HEAD");
|
|
|
|
config.addAllowedMethod("GET");
|
|
|
|
config.addAllowedMethod("PUT");
|
|
|
|
config.addAllowedMethod("POST");
|
|
|
|
config.addAllowedMethod("DELETE");
|
|
|
|
config.addAllowedMethod("PATCH");
|
|
|
|
source.registerCorsConfiguration("/**", config);
|
|
|
|
return new CorsFilter(source);
|
|
|
|
}
|
|
|
|
|
2017-04-16 17:59:17 +00:00
|
|
|
public static void main(String[] args) {
|
|
|
|
SpringApplication.run(SteleksProxyApplication.class, args);
|
|
|
|
}
|
|
|
|
}
|