'net::ERR_SSL_PROTOCOL_ERROR when calling http .net core api over https

my apps is containing of client(angular served by nginx), backend(.net core) with mariadb as database, all running in the docker container. After success with ssl certificate im dealing with error when the client calls api over https. here is my docker compose file

version: '3.7'
services:
  mariadb:
    image: mariadb
    restart: always
    volumes:
      - mariadb:/var/lib/mysql
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - TZ=${TZ}
    networks:
      - some-net
  bsbackend:
    container_name: bsbackend
    build: ./BSBackend
    ports:
      - "5101:80"
    depends_on:
      - mariadb
    environment:
      - DBHOST=mariadb
      - TZ=${TZ}
    restart: on-failure
    networks:
      - some-net

  bsclient:
    build: ./BSClient
    ports:
      - "80:80"
      - "443:443"
    environment:
      - TZ=${TZ}
    networks:
      - some-net
    volumes:
      - ./certbot/www:/var/www/certbot/:ro
      - ./certbot/conf/:/etc/nginx/ssl/:ro

  certbot:
    image: certbot/certbot:latest
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw

volumes:
  mariadb: {}
networks:
  some-net:
    driver: bridge

Here is my nginx config file

server {
    listen   80;
    listen [::]:80;

    server_name mydomain.abc www.mydomain.abc;

    location ~ /.well-known/acme-challenge/ {
        allow all;
        root /var/www/certbot;
    }

    location / {
        return 301 https://mydomain.abc$request_uri;
    }
}

server {
    listen 443 default_server ssl http2;
    listen [::]:443 ssl http2;

    root /usr/share/nginx/html;
    index index.html;

    server_name mydomain.abc;

    ssl_certificate /etc/nginx/ssl/live/mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/live/mydomain.com/privkey.pem;

    location / {
       try_files $uri /index.html;
    }

    location /api {
       proxy_pass http://mydomain.abc:5101;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
    }
}

Can anyone please help me why i get SSL protocol error please, i thought setting the proxy_pass in config should help.. Thank you so much.



Sources

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

Source: Stack Overflow

Solution Source