Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to redirect from HTTP to HTTPS? #16

Open
diavrank opened this issue Jul 23, 2020 · 0 comments
Open

How to redirect from HTTP to HTTPS? #16

diavrank opened this issue Jul 23, 2020 · 0 comments

Comments

@diavrank
Copy link

Hi, when I try to enter to my web app through HTTP appears this:

Screen Shot 2020-07-22 at 19 12 12

How can I configure my docker-compose.yml to redirect HTTP to HTTPS?

My current docker-compose.yml is the following:

version: '3'

services:
  app:
    container_name: app
    depends_on:
      - mongo
    image: myapp-web
    restart: on-failure
    build:
      context: .
      dockerfile: dockerfile
    env_file: docker.env
    networks:
      - farefo-net
  ssl-proxy:
    container_name: ssl-proxy
    image: justsml/ssl-proxy:latest
    environment:
      - HTTPS_PORT=443
      - SERVER_NAME=myapp.com
      - UPSTREAM_TARGET=app:3000
      - CERT_PUBLIC_PATH=/certs/fullchain.pem
      - CERT_PRIVATE_PATH=/certs/privkey.pem
    volumes:
      - /certs:/certs:ro
    ports:
      - 443:443
      - 80:443
    networks:
      - farefo-net
  mongo:
    container_name: mongo
    command:
      - --storageEngine=wiredTiger
    image: mongo:4.2.5-bionic
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: username
      MONGO_INITDB_ROOT_PASSWORD: password
    volumes:
      - $PWD/data:/data/db
      - $PWD/database:/opt/database
    networks:
      - farefo-net
networks:
  farefo-net:
@diavrank diavrank changed the title How to redirect HTTP to HTTPS? How to redirect from HTTP to HTTPS? Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant