access-control-allow-origin localhost code example
Example 1: access-control-allow-origin
Access-Control-Allow-Origin: *
Example 2: spring cors
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/greeting-javaconfig").allowedOrigins("http://localhost:9000");
}
};
}Copy