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

Use the same host as origin for single-server setups #1432

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

jordigh
Copy link
Contributor

@jordigh jordigh commented Feb 7, 2025

Context

Self-hosters often immediately face an obstacle by not setting APP_HOME_URL and getting a broken installation. There is no reason why this URL should be set in the most common case of a single server.

Proposed solution

We check to see if the user has not set APP_HOME_URL or encoded organisations as subdomains. In that case, we serve back the same origin as what we obtained from the browser request.

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

I removed the APP_HOME_URL setting from the tests that didn't need it and they still pass.

This parameter is intended to determine if a Grist installation is a
single URL installation or not. If it is, we can serve URLs from the
same source as the browser request.
This should handle the most common case of a single Grist site with a
single server, removing the need for the user to set up APP_HOME_URL
in this case.
@jordigh jordigh force-pushed the jordigh/app-home-url branch 2 times, most recently from 56be4f8 to 31f41d9 Compare February 7, 2025 19:28
These tests are for single-server setups that don't need this setting.
@jordigh jordigh force-pushed the jordigh/app-home-url branch from fb6de66 to 72e6c92 Compare February 7, 2025 20:28
@jordigh jordigh marked this pull request as ready for review February 7, 2025 20:48
Copy link
Member

@paulfitz paulfitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jordi! Looks plausible.

Copy link
Contributor

@Spoffy Spoffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously when we've talked about changes to APP_HOME_URL, we came to the conclusion it would be better if the frontend just used the current domain anyway:

https://grist.slack.com/archives/C0234CPPXPA/p1723133216228949?thread_ts=1722476711.309829&cid=C0234CPPXPA

As there's issues with reverse proxies not passing the Host header through, and the backend getting confused about what domain it's hosted on.

(Not sure if this is helpful, just relevant context)

@jordigh jordigh force-pushed the jordigh/app-home-url branch from 72e6c92 to ae1902f Compare February 10, 2025 21:10
@jordigh jordigh changed the title WIP: use the same host as origin for single-server setups Use the same host as origin for single-server setups Feb 11, 2025
@jordigh jordigh force-pushed the jordigh/app-home-url branch from ae1902f to 12f0f11 Compare February 11, 2025 21:36
@jordigh jordigh force-pushed the jordigh/app-home-url branch from 8ede53d to 09befb7 Compare February 11, 2025 21:47
@jordigh jordigh merged commit 499df94 into main Feb 11, 2025
12 checks passed
@jordigh jordigh deleted the jordigh/app-home-url branch February 11, 2025 22:48
@paulfitz
Copy link
Member

@jordigh Hmm this landed before I got to post this but: I ran a version of this PR against our saas tests (since it touches url handling which is fiddly) and there were some failures https://phab.getgrist.com/harbormaster/unit/20870/. I expect there may be small things to patch up, didn't see any red flag.

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

Successfully merging this pull request may close these issues.

3 participants