Error when connecting Angular app with REST-Django service

31 views Asked by At

I have an web application deployed on GKE. Front-end service is Angular 17 app running on Official NginX Docker container Load Balancer with Ingress. Backend is REST-Django service running on Gunicorn running on Official Python container. The problem is when I want to reach the service (GET method) from Angular I get error Reason: CORS request did not succeed in Firefox browser - Chromium says net::ERR_NAME_NOT_RESOLVED. The Django service has installed CORS:

INSTALLED_APPS = [ ... 'corsheaders', ...

MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', ... ]

CORS_ALLOW_ALL_ORIGINS = True

In local docker-compose environment everything works like it should.

From Angular's pod/container I am able to curl the Django service and it responds in desired way.

1

There are 1 answers

0
Mariful Islam Saad On

Not sure but you can try this. Add this line to your angular app's header.

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/>