Keycloak login sometimes slow behind reverse proxy

I’m installing Keycloak using codecentric/keycloakx helm chart on Kubernetes. When I enable Ingress, sometimes it can take as long as 8-9 seconds to access the admin console. However, when I disable Ingress and open the service object with port forwarding, I can access the console in less than 1 second.

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
    kubeadmConfigPatches:
      - |
        kind: InitConfiguration
        nodeRegistration:
          kubeletExtraArgs:
            node-labels: "ingress-ready=true"
    extraPortMappings:
      - containerPort: 80
        hostPort: 80
        protocol: TCP
      - containerPort: 443
        hostPort: 443
        protocol: TCP
  - role: worker
  - role: worker
  - role: worker
kind create cluster --name md --config ~/notes/kind/kind-ingress.yaml && sleep 5 && \
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml && \
kubectl wait --namespace ingress-nginx \
  --for=condition=ready pod \
  --selector=app.kubernetes.io/component=controller \
  --timeout=90s
replicas: 2

command:
  - "/opt/keycloak/bin/kc.sh"
  - "start"

extraEnvFrom: |
  - secretRef:
      name: '{{ include "keycloak.fullname" . }}-keycloak-secret'

secrets:
  keycloak-secret:
    type: Opaque
    stringData:
      KEYCLOAK_ADMIN: "admin"
      KEYCLOAK_ADMIN_PASSWORD: "admin"
      KC_DB_SCHEMA: "kc_temp"
      KC_HOSTNAME_STRICT: "false"
      KC_PROXY: "passthrough"
      JAVA_OPTS_APPEND: >-
        -Djgroups.dns.query={{ include "keycloak.fullname" . }}-headless

database:
  vendor: "postgres"
  hostname: "xxx"
  port: "xxx"
  database: "xxx"
  username: "xxx"
  password: "xxx"

ingress:
  enabled: true
  ingressClassName: "nginx"
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
  rules:
    - host: "keycloak.local"
      paths:
        - path: '{{ tpl .Values.http.relativePath $ | trimSuffix "/" }}/'
          pathType: ImplementationSpecific

http:
  relativePath: "/"

helm install -n kc-temp my-keycloakx codecentric/keycloakx --version 2.4.3 --values values.yaml

“.local” is a domain used specifically in macos, when I changed it the problem was solved.