# KC ignores port configuration

**URL:** <https://forum.keycloak.org/t/kc-ignores-port-configuration/27769>\
**Category:** Getting advice\
**Created:** [September 6, 2024, 8:47am UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769 "2024-09-06T08:47:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.riitano](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@a.riitano](https://forum.keycloak.org/u/a.riitano)\
**Post date:** [September 6, 2024, 8:47am UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769/1 "2024-09-06T08:47:03Z")

</div>

Hi there.  
I’m struggling to get an instance of keycloak I’m using for development to use https.  
The instance, version 24.0.2, runs completely fine under HTTP on port 80, but any configuration I enable about HTTPS is simply ignored.

The current configuration I use is:

```auto
export DEBUG_PORT=*:8888;
export KC_HTTP_ENABLED=false
export KC_HTTPS_ENABLED=true
export KC_HTTP_PORT=80
export KC_HTTPS_PORT=8443
export KC_HOSTNAME="https://mydomain.com:8443"
export KC_HOSTNAME_ADMIN="https://mydomain.com:8443"
export KC_HOSTNAME_BACKCHANNEL_DYNAMIC=false
export KC_HOSTNAME_DEBUG=true
export KC_HOSTNAME_STRICT=false
export KC_LOG_LEVEL="INFO"
export KC_HTTPS_CERTIFICATE_FILE="/etc/letsencrypt/live/mydomain/fullchain.pem"
export KC_HTTPSCERTIFICATE_KEY_FILE="/etc/letsencrypt/live/mydomain.com/privkey.pem"

/data/keycloak-24.0.2/bin/kc.sh --config-file "/data/keycloak-24.0.2/conf/quarkus.conf" --verbose start-dev -DSKIP_PARSE_PERSISTENCE_XML=true --https-port 443

```

Which has even a redundant https-port in command line, but then:

```auto
$ netstat -tulpn | grep java
tcp6 0 0 :::45545 :::* LISTEN 830825/java
tcp6 0 0 127.0.0.1:44331 :::* LISTEN 830825/java
tcp6 0 0 :::80 :::* LISTEN 830825/java

```

It listens on port 80, but the URL doesn’t work because it tries to load resources from https and “https” is not there to listen.

If I change the KC\_HTTP\_PORT, then it gets updated accordingly, but the HTTPS one is simply always ignored.

```auto
KC_HTTP_PORT=8080
...
$ netstat -tulpn | grep java
tcp6 0 0 :::8080 :::* LISTEN 830825/java

```

I’ve already tried to cancel and recreate the H2 DB without success.

Do you have any advice on how make it work?  
Thank you

---

<div class="post-metadata">

**Author:** ![embesozzi](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/embesozzi/32/12390_2.png) [@embesozzi](https://forum.keycloak.org/u/embesozzi)\
**Post date:** [September 6, 2024, 7:05pm UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769/2 "2024-09-06T19:05:13Z")

</div>

You life will be happier if you run Keycloak as Docker container [1] and even happier with Docker Compose [2]

[1] [Docker - Keycloak](https://www.keycloak.org/getting-started/getting-started-docker)  
[2] [keycloak-workshop-stepup-mfa-biometrics/docker-compose-idp.yml at main · embesozzi/keycloak-workshop-stepup-mfa-biometrics · GitHub](https://github.com/embesozzi/keycloak-workshop-stepup-mfa-biometrics/blob/main/docker-compose-idp.yml)

---

<div class="post-metadata">

**Author:** ![a.riitano](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@a.riitano](https://forum.keycloak.org/u/a.riitano)\
**Post date:** [September 9, 2024, 6:10am UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769/3 "2024-09-09T06:10:54Z")

</div>

Thank you for your advice.  
Unfortunately I cannot use docker on this host.  
I have another instance running fine with docker, but in this case I really need to configure a “direct” installation.

---

<div class="post-metadata">

**Author:** ![bpedersen2](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/bpedersen2/32/3934_2.png) [@bpedersen2](https://forum.keycloak.org/u/bpedersen2)\
**Post date:** [September 9, 2024, 2:44pm UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769/4 "2024-09-09T14:44:53Z")

</div>

probably don’t use start-dev, instead use build and start separatly.

---

<div class="post-metadata">

**Author:** ![a.riitano](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@a.riitano](https://forum.keycloak.org/u/a.riitano)\
**Post date:** [September 24, 2024, 9:56am UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769/5 "2024-09-24T09:56:18Z")

</div>

I tried even this, without success.  
It gives me an error about processing a request with java.io.E0FException and then it hangs (it even refuse to die, I need to kill it with -9.

---

<div class="post-metadata">

**Author:** ![a.riitano](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@a.riitano](https://forum.keycloak.org/u/a.riitano)\
**Post date:** [September 24, 2024, 9:59am UTC](https://forum.keycloak.org/t/kc-ignores-port-configuration/27769/6 "2024-09-24T09:59:11Z")

</div>

Anyway I found out that if I specify the ports using command line intead of ENV variables it works well:

```auto
keycloak-24.0.2/bin/ks.sh --verbose --start-dev --hostname-strict-backchannel=false --hostname-debug=true --log-level=INFO --https-certificate-file=[...] --https-certificate-key-file=[...] --debug

```

```auto
Listening on : http://0.0.0.0:8080 and https://0.0.0.0:8443

```

I wonder why…
