I have a simple Controller with a function.
@RestController
@CrossOrigin(origins = "http://localhost:4200", allowedHeaders = "*")
@RequestMapping("/api")
public class DockerController {
@Autowired
private DockerService dockerService;
@PostMapping("/docker/container/{containerName}/pause")
public boolean pauseContainer(@PathVariable String containerName) {
dockerService.pauseContainer(containerName);
return true;
}
}
But when i try to run it from the angular app i get
zone.js:2969 POST http://localhost:8080/api/docker/container/Env666/pause 403 () http://localhost:8080/api/docker/container/Env666/pause: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 403.
This started happening after I used the service functionallity.