bsejawal / reactjs

0 stars 0 forks source link

How to fix CORS issue in reactjs (axios) to call spring boot rest api #1

Open bsejawal opened 1 year ago

sir-braz commented 1 year ago

To enable CORS, you need to enable it using this code.

@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("http://localhost:3000") .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "TRACE", "CONNECT"); }