Solved: Grist Inaccessible behind Traefik, likely configuration error

Hello!

Thank you for your work on this product. It looks quite promissing.

I am an exerpienced self-hoster, sysadmin, and dev-ops professional, so I have given this a real try and searched all available resources throughly.

I am running over a dozen services at home behind Traefik, Authelia, and Cloudflare. They run great, and with the exception of Grist, the Traefik configuration is essientially copy-and-paste a few labels, and it just works.

This is the grist section of the docker-compose I am working with at the moment, don’t let the non-default options scare you, I have tried hundreds of combinations at this point:

  grist:
    container_name: grist
    image: gristlabs/grist
    networks:
      t2_proxy:
    restart: always
    environment:
      - PGID=1000
      - PUID=1000
      - DEBUG=1
      - PORT=8485
      - APP_DOC_INTERNAL_URL=http://localhost:8485
      - APP_DOC_URL=https://grist.DOMAINREDACTED
      - APP_HOME_URL=http://grist.DOMAINREDACTED
      - GRIST_SINGLE_ORG=docs
      - GRIST_ORG_IN_PATH=true
      - GRIST_DOMAIN=https://grist.DOMAINREDACTED
      - GRIST_DEFAULT_EMAIL=EMAILREDACTED
      - GRIST_SESSION_COOKIE=grist.DOMAINREDACTED
      # - GRIST_MAX_UPLOAD_ATTACHMENT_MB=2560
      # - GRIST_MAX_UPLOAD_IMPORT_MB=2560
       - HTTPS=auto
    # ports:
    #   - "8485:8485"
    volumes:
      - $DOCKERDIR/appdata/grist/data:/persist
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.grist-rtr.entrypoints=https"
      - "traefik.http.routers.grist-rtr.rule=Host(`grist.DOMAINREDACTED`)"
      # - "traefik.http.routers.grist-rtr.tls=true"
      ## Middlewares
      - "traefik.http.routers.grist-rtr.middlewares=chain-authelia@file"
      ## HTTP Services
      - "traefik.http.routers.grist-rtr.service=grist-svc"
      - "traefik.http.services.grist-svc.loadbalancer.server.port=8485"

and the Grist logs:

Welcome to Grist.
2022-10-03 15:52:26.878 - info: == Grist version is 0.1.1 (commit unknown)
2022-10-03 15:52:26.904 - info: Loading empty config because /persist/config.json missing
2022-10-03 15:52:26.919 - warn: did not find an appropriately named example workspace in deployment
2022-10-03 15:52:26.924 - info: No plugins directory: ENOENT: no such file or directory, scandir '/grist/.grist/plugins'
2022-10-03 15:52:26.932 - info: Found 1 valid plugins on the system
2022-10-03 15:52:26.933 - debug: PLUGIN builtIn/core -- /grist/plugins/core
2022-10-03 15:52:26.943 - info: Server timeouts: keepAliveTimeout 305000 headersTimeout 306000
2022-10-03 15:52:26.947 - info: server(home,docs,static) available at 0.0.0.0:8485
2022-10-03 15:52:26.972 - info: activity docCount=0, orgCount=1, orgInGoodStandingCount=1, userCount=6, userWithLoginCount=6
2022-10-03 15:52:26.977 - warn: Failed to create GoogleAuth endpoint: GOOGLE_CLIENT_SECRET is not defined
2022-10-03 15:52:26.985 - info: == appRoot: /grist
2022-10-03 15:52:26.985 - info: == i18:locale: en
2022-10-03 15:52:26.986 - info: == i18:namespace: core
2022-10-03 15:52:26.986 - info: == docsRoot: /persist/docs
2022-10-03 15:52:26.986 - info: == defaultBaseDomain: grist.DOMAINREDACTED
2022-10-03 15:52:26.986 - info: == pluginUrl: undefined
2022-10-03 15:52:26.986 - info: == instanceRoot: /persist
2022-10-03 15:52:26.986 - info: == tag: unknown
2022-10-03 15:52:26.986 - info: == database: sqlite:///persist/home.sqlite3
2022-10-03 15:52:26.986 - info: == userRoot: /grist/.grist
2022-10-03 15:52:26.986 - info: == loginMiddlewareComment: no-logins
2022-10-03 15:52:26.987 - info: == docWorkerId: testDocWorkerId_8485
2022-10-03 15:52:26.987 - info: == grist.login.system.forwardAuth.header: - [GRIST_FORWARD_AUTH_HEADER]
2022-10-03 15:52:26.987 - info: == grist.login.skipSession: - [GRIST_IGNORE_SESSION]
2022-10-03 15:52:26.987 - info: == grist.login.forced: - [GRIST_FORCE_LOGIN]
2022-10-03 15:52:26.988 - info: == grist.externalStorage.disable: - [GRIST_DISABLE_S3]
2022-10-03 15:52:26.988 - info: == grist.externalStorage.active: false

Here is my Traefik dashboard showing that it sees Grist and thinks everything is good:

Any help is appreciated! Thanks.

Edit:

After some tweaking (config updated), I was able to get to a “The page isn’t redirecting properly” error in Firefox when visiting the root domain.

Here are the logs recording my visit:

2022-10-03 16:55:56.187 - debug: Auth[GET]: grist.DOMAINREDACTED / customHostSession=, method=GET, host=grist.DOMAINREDACTED, path=/, org=docs, email=anon@getgrist.com, userId=1, altSessionId=IDREDACTED
2022-10-03 16:55:56.207 - debug: Authorizer: redirecting to sign up
2022-10-03 16:55:56.247 grist.DOMAINREDACTED GET / 302 68.350 ms - 98

Interestingly though, if I go to grist.DOMAINREDACTED/{anything}, I get a working “Page not found” error page within Grist, though I cannot upload the photo because my account is too new.

Any link clicked from there goes back to the Firefox redirection error.

Edit2:

I kept tweaking my config and got rid of the redirection error. I now get an error 500 on any page but the home page:

“There was an error: Request to http://grist.DOMAINREDACTED/o/docs/api/session/access/active failed with status 500: Internal Server Error (Invalid URL: null).”

The Firefox network console is also saying this: “Cookie “grist.DOMAINREDACTED_status” has been rejected for invalid domain.”

Any ideas?

Edit3:

Solved

I can’t believe I missed it. I knew it was something basic. I was missing the “s” in the https:// of my app-url… Man, that one hurts!

Ouch, glad you found it!