Inaccessible behind Traefik Proxy

I’ve read through a bunch of posts about running Discourse behind a Traefik proxy, but unfortunately I seem to still be missing something.

From the host if I curl the internal IP of the container I can see the Discourse setup wizard html returned and Traefik reports that the service is available:

However when I attempt to connect to the domain that goes through Traefik I can see the expected https certificate but then get a 504 after several seconds.

Here’s my Discourse config:

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"

expose:
  #- "80:80"   # http
  #- "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

env:
  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8

  DISCOURSE_HOSTNAME: 'redacted'
  DISCOURSE_DEVELOPER_EMAILS: 'redacted'

  DISCOURSE_SMTP_ADDRESS: smtp.postmarkapp.com
  DISCOURSE_SMTP_USER_NAME: redacted
  DISCOURSE_SMTP_PASSWORD: redacted
  DISCOURSE_NOTIFICATION_EMAIL: noreply@redacted

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /opt/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /opt/discourse/shared/standalone/log/var-log
      guest: /var/log

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

docker_args:
  - "-l traefik.enable=true"
  - "-l traefik.http.routers.discourse.tls=true"
  - "-l traefik.http.routers.discourse.rule=Host(`redacted`)"
  - "-l traefik.http.routers.discourse.entrypoints=websecure"
  - "-l traefik.http.routers.discourse.tls.certresolver=ledns"
  - "-l traefik.http.services.discourse.loadbalancer.server.port=80"
  - "-l traefik.http.services.discourse.loadbalancer.server.scheme=http"

run:
  - exec: echo "Beginning of custom commands"
  - exec: echo "End of custom commands"

I have many other services in the same Traefik instance configured similarly on different hosts and they are all working.

In the Discourse nginx access logs I can see the request when I curl the local IP, but not when I curl the domain.

Any suggestions on what is missing? It seems like it’s getting lost somewhere between Traefik and nginx.

I found the issue. Traefik and Discourse were on different docker networks. Adding a docker flag to put it on the same network solved the issue.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.