I have controller like this
@RestController
@RequestMapping("/api/v1/country/")
@RequiredArgsConstructor
@CrossOrigin(origins = "http://localhost:8082")
public class CountryController {
private final CountryService countryService;
@GetMapping("getAll")
public ResponseEntity<GetAllCountriesResponse> getAllCountries() {
return ResponseEntity.ok(countryService.getAllCountriesResponse());
}
}
and i’m trying to send request from vue js app on http://localhost:8082/ to server on http://localhost:8081/
like so
axios(“http://localhost:8081/api/v1/country/getAll”)
when i’m using postman everything is fine, but when i try to do this in vue js i get
Acess to XMLHttpRequest at ‘http://localhost:8081/api/v1/country/getAll’ from origin ‘http://localhost:8082’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
How can i configure this on spring v3.0.1