Error when using Delete method in Angular

0

I have an application in Angular4 + Spring boot with the following error when I try to execute method delete

  

Cross-Origin Request Blocked

The same source rule prevents me from reading the link link.

(Reason: CORS 'Access-Control-Allow-Origin' header is missing).

    
asked by anonymous 13.06.2018 / 19:25

1 answer

0

In your code Spring boot , you should create a class that extends the WebSecurityConfigurerAdapter class and implement the configure(HttpSecurity http) method by calling the function

http.cors().and().csrf().disable()

Your code should then look like this:

@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.cors()
            .and()
            .csrf()
            .disable()
    }
}
    
19.06.2018 / 17:00