docker serve content over https without domain (only with public IP Address)

  docker, nginx, nginx-reverse-proxy, openssl, ssl

I have two different servers. At Server 1 I have a domain and a IP Address and at Server 2 I have only a public IP Address.
At Server 1 I am hosting a webpage and at Server 2 I am hosting the webservice.
When I want to connect from Server 1 to Server 2 I get the following error:

This request has been blocked; the content must be served over HTTPS

I dont get it done to serve the content from the webservice over HTTPS. First I tried it with letsencrypt and nginx reverse proxy but there I get the error that an IP Address cant be verified with SSL. Then I tried it without letsencrypt but then I get the content only over http. How can I serve my content with https and docker when I have only a public IP address without a domain?
This is my docker-compose file:

version: "3.3"

services:
  proxy:
    image: jwilder/nginx-proxy:alpine
    container_name: proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      ### required for Let's Encrypt certificates
      - nginx_certs:/etc/nginx/certs:ro
      - nginx_vhosts:/etc/nginx/vhost.d
      - nginx_html:/usr/share/nginx/html
    restart: always
  # letsencrypt:
  #   image: jrcs/letsencrypt-nginx-proxy-companion
  #   environment:
  #   ### ToDo: Change to your e-mail address
  #     - [email protected]
  #     - NGINX_PROXY_CONTAINER=proxy
  #   volumes_from:
  #     - proxy
  #   volumes:
  #     - /var/run/docker.sock:/var/run/docker.sock:ro
  #     - nginx_certs:/etc/nginx/certs:rw
  #   restart: always
  whoami:
    image: jwilder/whoami
    environment:
      - VIRTUAL_HOST=IP_ADDRESS
      - VIRTUAL_PROTO=https
volumes:
  #### NGINX reverse proxy container volumes
  nginx_certs:
  nginx_vhosts:
  nginx_html:

Source: Docker Questions

LEAVE A COMMENT