'ERR_SSL_PROTOCOL_ERROR by using prometheus and docker

i try to implement a docker-compose where my self created chat is connecting to a mongo image. This works fine. my chat is running with a https connection, that works fine with the mongo image. now i want to monitor my containers with prometheus. i set it up and i think it wants to connect to my port connection, but im getting in different browsers, an error like ERR_SSL_PROTOCOL_ERROR or PR_END_OF_FILE_ERROR. i dont found similar questions or solutions in the web. some said to switch the connection from https to http but this isnt a solution for my problem.

docker-compose.yml:

version : '3.7'
services:
  chat-api:
    container_name: chat-api
    build:
      context: .
      dockerfile: ./Dockerfile 
    ports: 
      - '4000:4000'
    networks:
      - cchat
    restart: 'on-failure'
  userdb:
    image: mongo:latest 
    container_name: mongodb
    volumes:
      - userdb:/data/db
    networks:
      - cchat 
  prometheus: 
    image: prom/prometheus:latest
    container_name: prometheus 
    restart: always 
    volumes: 
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - prometheus-data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - '9090:9090'
    networks:
      - cchat
  cadvisor: 
    image: gcr.io/cadvisor/cadvisor:latest 
    container_name: cadvisor 
    restart: always 
    volumes: 
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker:/var/lib/docker:ro
    devices:
      - /dev/kmsg:/dev/kmsg
    depends_on:
      - chat-api
    networks:
      - cchat


volumes:
  userdb:
  prometheus-data:
networks:
  cchat:  

prometheus.yml:

global: 
  scrape-interval: 2s 

scrape_configs:
  - job_name: 'cadvisor'
    static_configs:
      - targets: ['cadvisor:8080']

parts of my server.js that is a snipped of my chat application:

const express= require('express');
const app= express();
const https= require('https');
const fs = require('fs');
const PORT=process.env.PORT || 4000

//https configuarion
const options={
    key: fs.readFileSync('cert/key.pem'),
    cert: fs.readFileSync('cert/cert.pem')
}

//server inizialisation
var server= https.createServer(options,app)

const {Server} = require('socket.io')

const io= new Server(server,{maxHttpBufferSize:10e7})

server.listen(PORT, ()=>{
    console.log('server is listening on port '+PORT)
})

when i connect to https://localhost:4000 i get my chat application, but when i try to connect to https://localhost:9090 i get this instead for my prometheus dashboard.

https://i.stack.imgur.com/umm0m.png



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source