CORS errors when deploying Spring Boot and Angular app in Docker

  angular, cors, docker, spring, spring-boot

I have deployed 3 docker containers – for the database, the backend (Spring boot) and the frontend (Angular). However, when I am visiting the website (Google Cloud VM), I am getting CORS error for all the requests to backends. The backend is run on 8080.

I am getting CORS when I am visiting the IP:80

Why is this happening? What is the workaround?

Here is the way I have used CrossOrigin in the controller.

public class CustomerController {

Any help is appreciated.

Source: StackOverflow