How to setup a Kong local environment with HTTPS enabled

Hello Everyone,
I’m facing a configuration issue while setting up Kong API Gateway (Open Source Edition) in a containerized environment.

Following the official Kong documentation, I used the commands below to set up Kong:

Network Creation:

docker network create kong-net

PostgreSQL Container Setup:

docker run -d --name kong-database \
  --network=kong-net \
 -p 5432:5432 \
  -e "POSTGRES_USER=kong" \
  -e "POSTGRES_DB=kong" \
  -e "POSTGRES_PASSWORD=kongpass" \
  postgres:13

Database Bootstrap:

docker run --rm --network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=kongpass" \
kong/kong-gateway:3.7.1.2 kong migrations bootstrap

Kong Gateway Setup:

docker run -d --name kong-gateway \
  --network=kong-net \
  -e "KONG_DATABASE=postgres" \
  -e "KONG_PG_HOST=kong-database" \
  -e "KONG_PG_USER=kong" \
  -e "KONG_PG_PASSWORD=kongpass" \
  -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
  -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
  -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
  -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
  -e "KONG_ADMIN_LISTEN=0.0.0.0:8001" \
  -e "KONG_ADMIN_GUI_URL=http://localhost:8002" \
  -e KONG_LICENSE_DATA \
  -p 8000:8000 \
  -p 8443:8443 \
  -p 8001:8001 \
  -p 8444:8444 \
  -p 8002:8002 \
  -p 8445:8445 \
  kong/kong-gateway:3.7.1.2

While this setup works, and I can access the Kong Manager on port 8002, I’m having trouble enabling HTTPS. When I change the manager URL to https://localhost:8445, the GUI shows a CORS error when trying to access the Admin API on port 8444.

How can I properly configure HTTPS for the Kong Manager without encountering CORS issues? The CORS plugin is not the solution because it should be related to the API endpoint.

I’ve tried several things like removing the

KONG_ADMIN_GUI_URL

parameter, but nothing seems to work.
How can i fix it ?

@docdev Please see these resources:

https://support.konghq.com/support/s/article/How-to-setup-CORS-to-allow-the-Dev-Portal-and-Kong-Manager-to-call-the-Admin-Api

I’ve already used that command, but it was for the previous version:

Home