package uk.ac.ebi.subs.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * This configuration file sets up CORS.
 * 
 * Created by karoly on 21/07/2017.
 */
@Configuration
public class CORSConfiguration {
    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/api/**");
            }
        };
    }
}

@@ -727,30 +727,199 @@
 stry
-.addMapping(%22/api/**%22)
+%0A                        .addMapping(%22/api/**%22)%0A                        .allowedOrigins(%22*%22)%0A                        .allowedMethods(%22PUT%22, %22POST%22, %22GET%22, %22OPTIONS%22, %22PATCH%22)%0A                
 ;%0A  

add CORS origin and method support