title: Docker-compose: connections between https express servers
body: <p>Two Express servers are running within docker containers under docker-compose.</p>
  
  <pre><code>version: '2'
  services:
    server-1:
      build: .
      ports:
        - "8080:8080"
      links:
        - db
      volumes:
        - .:/www
        - /www/node_modules
    server-2:
      build: ../server-2
      links:
        - api-server
      volumes:
        - ../server-2/:/www
        - /www/node_modules
  </code></pre>
  
  <p><code>server-2</code> connects to <code>server-1</code> through socket connection with this address: <code>http://server-1:8080</code> (socket.io library).<br>
  Everything works perfect.  </p>
  
  <p>But if i'm trying to use <code>https</code> module instead of <code>http</code> inside <code>server-1</code>, then <code>server-2</code> can't connect to it. I've tried pretty much all variations of changing ports (8080 to 443 etc) and changing socket connection address protocol from <code>http</code> to <code>https</code>.</p>
  
  <p>Only one variable persists all the time: i can run server on any port with <code>http</code> and connection being established, but once it changed to <code>https</code>, it stops connecting.</p>