SteveLTN / https-portal

A fully automated HTTPS server powered by Nginx, Let's Encrypt and Docker.
MIT License
4.41k stars 295 forks source link

502 Bad Gateway when trying to redirect to a sample Nginx container #312

Closed tommywalkie closed 2 years ago

tommywalkie commented 2 years ago

Hi @SteveLTN , I successfully could test/deploy https-portal using stuff like Ghost CMS, Wordpress, or Strapi. But I still face a weird issue for simplier containers, like a default Nginx/Caddy one.

version: '3.1'

services:
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - '80:80'
      - '443:443'
    links:
      - strapi
      - blog
    restart: always
    environment:
      DOMAINS: 'domain.com -> http://blog:8080, www.domain.com -> http://blog:8080, api.domain.com -> http://strapi:1337'
      STAGE: 'production'
    depends_on:
      - blog

  blog:
    image: nginx
    ports:
      - '8080:80'

  strapi:
    image: strapi/strapi
    # environment: ...
    volumes:
      - strapi-volume:/srv/app
    ports:
      - '1337:1337'
    depends_on:
      - postgres

  postgres:
    image: postgres
    # environment: ...
    volumes:
      - postgres-volume:/var/lib/postgresql/data

volumes:
  strapi-volume:
  postgres-volume:

I am able to reach the Nginx container welcome page through my IP address :8080 but for some reason, https-portal can't redirect to it.

SteveLTN commented 2 years ago

Hi,

First of all, you are not doing redirection. -> is for reverse proxying. I assume that’s just a typo and you actually meant to reverse proxy to your services.

I believe ports: 8080:80 is to map the 80 of the container to 8080 of the host. When accessing from another container e.g. HTTPS-PORTAL, you should still use 80.

Try domain.com -> http://blog:80.

On Thu, 26 May 2022 at 23:59 Tom Bazarnik @.***> wrote:

Hi @SteveLTN https://github.com/SteveLTN , I successfully could test/deploy https-portal using stuff like Ghost CMS, Wordpress, or Strapi. But I still face a weird issue for simplier containers, like a default Nginx/Caddy one.

version: '3.1' services: https-portal: image: steveltn/https-portal:1 ports:

  • '80:80'
  • '443:443' links:
  • strapi
  • blog restart: always environment: DOMAINS: 'domain.com -> http://blog:8080, www.domain.com -> http://blog:8080, api.domain.com -> http://strapi:1337' STAGE: 'production' depends_on:
  • blog

    blog: image: nginx ports:

  • '8080:80'

    strapi: image: strapi/strapi

    environment: ...

    volumes:

  • strapi-volume:/srv/app ports:
  • '1337:1337' depends_on:
  • postgres

    postgres: image: postgres

    environment: ...

    volumes:

  • postgres-volume:/var/lib/postgresql/data volumes: strapi-volume: postgres-volume:

I am able to reach the Nginx container welcome page through my IP address :8080 but for some reason, https-portal can't redirect to it.

— Reply to this email directly, view it on GitHub https://github.com/SteveLTN/https-portal/issues/312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD4AZ3M6UDRDGXQY6PALNLVL6NVJANCNFSM5XBTP4AA . You are receiving this because you were mentioned.Message ID: @.***>

tommywalkie commented 2 years ago

This fixed my problem, thank you @SteveLTN !