CSS: addcorsmappings registry.addmapping Example

By

CSS Example: This is the "addcorsmappings registry.addmapping" Example. compiled from many sources on the internet by SimpleTutorials.org

addCorsMappings registry.addMapping

//for Spring Boot
@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/api/**")
            .allowedOrigins("http://domain2.com")
            .allowedMethods("PUT", "DELETE")
            .allowedHeaders("header1", "header2", "header3")
            .exposedHeaders("header1", "header2")
            .allowCredentials(false).maxAge(3600);
    }
}



* Summary: This "addcorsmappings registry.addmapping" CSS Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!

Others