question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hosting on a subdomain other than docs.example.com with reverse proxy

See original GitHub issue

I would like to host Grist on a subdomain using my reverse proxy (traefik). Any help appreciated.

The following docker-compose works correctly and serves grist through my traefik reverse proxy at https://docs.example.com with OAuth authentication via a traefik middleware.

  grist:
    image: gristlabs/grist
    container_name: grist
    restart: unless-stopped
    networks:
      - t2_proxy
    security_opt:
      - no-new-privileges:true
    volumes:
      - $CONFIG/grist:/persist
    environment:
      - DEBUG=1
      - GRIST_SINGLE_ORG=docs
      - APP_DOC_URL=https://docs.$DOMAINNAME
      - APP_HOME_URL=https://docs.$DOMAINNAME
      - GRIST_DEFAULT_EMAIL=$MY_EMAIL
    user: $PUID:$PGID
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.grist-rtr.entrypoints=https"
      - "traefik.http.routers.grist-rtr.rule=Host(`docs.$DOMAINNAME`)"
      ## Middlewares
      - "traefik.http.routers.grist-rtr.middlewares=chain-oauth@file"
      ## HTTP Services
      - "traefik.http.routers.grist-rtr.service=grist-svc"
      - "traefik.http.services.grist-svc.loadbalancer.server.port=8484"

So far so good. I now want to serve grist from https://grist.example.com instead of https://docs.example.com so tried the following;

  grist:
    image: gristlabs/grist
    container_name: grist
    restart: unless-stopped
    networks:
      - t2_proxy
    security_opt:
      - no-new-privileges:true
    volumes:
      - $CONFIG/grist:/persist
    environment:
      - DEBUG=1
      - GRIST_SINGLE_ORG=grist # <<<<< CHANGED
      - APP_DOC_URL=https://grist.$DOMAINNAME # <<<<< CHANGED
      - APP_HOME_URL=https://grist.$DOMAINNAME # <<<<< CHANGED
      - GRIST_DEFAULT_EMAIL=$MY_EMAIL
    user: $PUID:$PGID
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.grist-rtr.entrypoints=https"
      - "traefik.http.routers.grist-rtr.rule=Host(`grist.$DOMAINNAME`)" #<<<<<  CHANGED
      ## Middlewares
      - "traefik.http.routers.grist-rtr.middlewares=chain-oauth@file"
      ## HTTP Services
      - "traefik.http.routers.grist-rtr.service=grist-svc"
      - "traefik.http.services.grist-svc.loadbalancer.server.port=8484"

This doesn’t work. I see the following. Also, if I click the yellow Y icon and then click @You under Switch Sites, it goes to https://docs.example.com. Is that hard coded?

Screenshot 2022-02-17 162608

Debug logs with personal info altered;

yarn run v1.22.17
$ NODE_PATH=_build:_build/stubs node _build/stubs/app/server/server.js
Welcome to Grist.
2022-02-17 16:35:11.875 - info: == Grist version is 0.1.1 (commit unknown)
2022-02-17 16:35:11.881 - info: Loading empty config because /persist/config.json missing
2022-02-17 16:35:11.907 - warn: did not find an appropriately named example workspace in deployment
2022-02-17 16:35:11.910 - info: No plugins directory: ENOENT: no such file or directory, scandir '/.grist/plugins'
2022-02-17 16:35:11.919 - info: Found 1 valid plugins on the system
2022-02-17 16:35:11.919 - debug: PLUGIN builtIn/core -- /plugins/core
2022-02-17 16:35:11.926 - info: Server timeouts: keepAliveTimeout 305000 headersTimeout 306000
2022-02-17 16:35:11.929 - info: server(home,docs,static) available at 0.0.0.0:8484
2022-02-17 16:35:11.959 - info: activity docCount=0, orgCount=0, orgInGoodStandingCount=0, userCount=5, userWithLoginCount=5
2022-02-17 16:35:11.964 - warn: Failed to create GoogleAuth endpoint: GOOGLE_CLIENT_SECRET is not defined
2022-02-17 16:35:11.971 - info: == appRoot: /
2022-02-17 16:35:11.971 - info: == docsRoot: /persist/docs
2022-02-17 16:35:11.971 - info: == defaultBaseDomain: .example.com
2022-02-17 16:35:11.972 - info: == pluginUrl: undefined
2022-02-17 16:35:11.972 - info: == instanceRoot: /persist
2022-02-17 16:35:11.972 - info: == tag: unknown
2022-02-17 16:35:11.972 - info: == database: sqlite:///persist/home.sqlite3
2022-02-17 16:35:11.972 - info: == userRoot: /.grist
2022-02-17 16:35:11.972 - info: == loginMiddlewareComment: no-logins
2022-02-17 16:35:11.973 - info: == s3: disabled
2022-02-17 16:35:11.973 - info: == docWorkerId: testDocWorkerId_8484
2022-02-17 16:35:54.154 - debug: Auth[GET]: id 5 email email@example.com host grist.example.com path / org grist
2022-02-17 16:35:54.190 grist.example.com GET / 200 25.138 ms - 3419
2022-02-17 16:35:54.540 - debug: Auth[GET]: id 5 email email@example.com host grist.example.com path /session/access/all org grist
2022-02-17 16:35:54.604 grist.example.com GET /o/grist/api/session/access/all 304 42.019 ms - -
2022-02-17 16:35:54.614 - debug: Auth[GET]: id 5 email email@example.com host grist.example.com path /session/access/active org grist
2022-02-17 16:35:54.669 grist.example.com GET /o/grist/api/session/access/active 304 40.536 ms - -

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
robflatecommented, Feb 18, 2022

Thanks. I can confirm the updated docker image fixes the account page bug.

1reaction
paulfitzcommented, Feb 17, 2022

Thanks @robflate for the clear and detailed report. I’m looking into it, feels like something is off. In the meantime, you could try this combination: GRIST_SINGLE_ORG=docs with the grist.example.com APP_*_URLs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Set Up a Reverse Proxy (Step-By-Step for Nginx ...
Comprehensive Reverse Proxy guide for WordPress. Learn how to load a different WordPress site from a subdirectory via reverse proxy.
Read more >
doc about a reverse proxy example · Discussion #1049 - GitHub
Hosting both systems and routing paths with a Reverse Proxy such as Nginx or Envoy or AWS API Gateway is the best solution....
Read more >
Hosting your Blog on a Subdomain vs Subdirectory - Letterdrop
A reverse proxy sits in front of your site and intercepts messages from your visitor's browsers. It decides whether to send the request...
Read more >
Hosting on a custom domain | Help Center - Foleon
Step-by-step instructions to publish Foleon Docs on your custom domain. ... the reverse proxy checkbox unless you're sure it matches your hosting setup....
Read more >
What is a Reverse Proxy and How Can it Help My SEO? - Moz
By acting as a content broker, your master server acts as a proxy to the content of your other servers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found