KONG Admin GUI Network Error Using Nginx Container

Hi,

I Have Kong Gateway running as docker container. This is my docker compose:

  kong-cp:
    image: '${GW_IMAGE:-kong/kong-gateway:3.11.0.2}'  # Main Kong Gateway Control Plane (default to latest version)
    container_name: kong-cp
    restart: on-failure
    networks:
      - net-docker
    environment:
      <<: *kong-env
      KONG_ADMIN_LISTEN: 0.0.0.0:8001, 0.0.0.0:8444 ssl
      KONG_ADMIN_GUI_LISTEN: 0.0.0.0:8002, 0.0.0.0:8445 ssl
      KONG_ADMIN_GUI_URL: https://kong-console.mycompany.com
      KONG_ADMIN_API_URL: https://kong.mycompany.com
      KONG_PASSWORD: handyshake 
    depends_on:
      kong-bootstrap:
        condition: service_completed_successfully  # Start only after bootstrap has succeeded
    ports:
      - "18000:8000"  # Proxy HTTP
      - "18443:8443"  # Proxy HTTPS
      - "8001:8001"  # Admin API HTTP
      - "8444:8444"  # Admin API HTTPS
      - "8002:8002"  # Kong Manager HTTP
      - "8445:8445"  # Kong Manager HTTPS

I want to use nginx container to setup the ssl for KONG API and GUI. So I have setup nginx.conf for kong as follows:

upstream kongapi {
    server kong-cp:8000;
}

upstream kongui {
    server kong-cp:8002;
}

server {
    listen 80;
    server_name kong.mycompany.com;
    return 301 https://$host$request_uri;
    # return 301 https://kong.mycompany.com $request_uri;     
}


server {
    listen 443 ssl;
    server_name kong.mycompany.com;


    ssl_certificate /etc/ssl/star_mycompany_com_2025.pem;
    ssl_certificate_key /etc/ssl/star_mycompany_com_2025.key;

    # API proxy
    location / {
        proxy_pass http://kongapi;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }

}

server {
    listen 80;
    server_name kong-console.mycompany.com;
    return 301 https://kong-console.mycompany.com$request_uri;     
    # return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name kong-console.mycompany.com;

    ssl_certificate /etc/ssl/star_mycompany_com_2025.pem;
    ssl_certificate_key /etc/ssl/star_mycompany_com_2025.key;

    # UI proxy
    location / {
        proxy_pass http://kongui;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;    
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }

}

When I testing the API via dns it is working.

But the GUI showing Network Error

Did i miss something in the configuration? Or should I use kong’s default nginx?

Thanks in advance.