Skip to content

docs(self-hosting): document docker webapp URL mismatch troubleshooting#28740

Open
jeevan6996 wants to merge 4 commits intocalcom:mainfrom
jeevan6996:docs/28712-docker-webapp-url-mismatch
Open

docs(self-hosting): document docker webapp URL mismatch troubleshooting#28740
jeevan6996 wants to merge 4 commits intocalcom:mainfrom
jeevan6996:docs/28712-docker-webapp-url-mismatch

Conversation

@jeevan6996
Copy link
Copy Markdown

Summary

  • clarify that custom-domain self-hosted Docker setups must use matching build-time values for NEXT_PUBLIC_WEBAPP_URL
  • add explicit troubleshooting guidance for WEBAPP_URL/ALLOWED_HOSTNAMES mismatch and OAuth redirect loops
  • document expected ALLOWED_HOSTNAMES format and a quick BUILT_NEXT_PUBLIC_WEBAPP_URL verification command

Why

Issue #28712 reports OAuth loops caused by hostname mismatch even when runtime env vars look correct. The missing piece is usually image build-time values, not runtime-only config.

Fixes #28712

@github-actions github-actions Bot added the 🐛 bug Something isn't working label Apr 4, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/self-hosting/docker.mdx">

<violation number="1" location="docs/self-hosting/docker.mdx:153">
P2: New troubleshooting guidance conflicts with existing `NEXTAUTH_URL` guidance in the same doc, creating ambiguous OAuth/auth-loop configuration.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread docs/self-hosting/docker.mdx Outdated
@jeevan6996
Copy link
Copy Markdown
Author

Thanks! This docs PR is ready for full CI. Could a maintainer please add the run-ci label (external contributor trust gate) so all checks can run? I will address any feedback quickly.

@jeevan6996
Copy link
Copy Markdown
Author

Addressed the guidance conflict around auth URLs in Docker docs and pushed an update: is documented as the public app URL, and is clarified per callback strategy (including the internal callback scenario described earlier in the doc).

@jeevan6996
Copy link
Copy Markdown
Author

Correction: addressed the guidance conflict around auth URLs in Docker docs and pushed an update. NEXT_PUBLIC_WEBAPP_URL is documented as the public app URL, and NEXTAUTH_URL is clarified per callback strategy, including the internal localhost callback scenario described earlier in the doc.

@jeevan6996
Copy link
Copy Markdown
Author

CI root cause identified: the failing check is gating external contributors until a maintainer adds the label. I don’t have permissions to add labels on this repo. Could a maintainer please add to trigger the full CI matrix?

@jeevan6996
Copy link
Copy Markdown
Author

Correction: CI root cause identified. The failing required check is gating external contributors until a maintainer adds the run-ci label. I do not have permissions to add labels on this repo. Could a maintainer please add run-ci to trigger the full CI matrix?

@jeevan6996 jeevan6996 force-pushed the docs/28712-docker-webapp-url-mismatch branch from 15427ec to c31f46e Compare April 16, 2026 17:47
@jeevan6996 jeevan6996 marked this pull request as ready for review April 16, 2026 22:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

Documentation for the Docker guide was updated with expanded self-hosting troubleshooting for OAuth hostname mismatches. It instructs inspecting the build-time BUILT_NEXT_PUBLIC_WEBAPP_URL inside runtime containers and rebuilding images if it still points to http://localhost:3000. The CLIENT_FETCH_ERROR guidance was reworded to clarify that the Auth callback uses the web app URL and to show using NEXTAUTH_URL=http://localhost:3000/api/auth for internal callback requests while keeping NEXT_PUBLIC_WEBAPP_URL as the public domain. A new WEBAPP_URL and ALLOWED_HOSTNAMES mismatch section lists verification steps and a Docker inspection command.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: documentation updates for Docker webapp URL mismatch troubleshooting in self-hosting scenarios.
Description check ✅ Passed The description is directly related to the changeset, explaining why the Docker documentation updates are needed and referencing the linked issue.
Linked Issues check ✅ Passed The PR successfully addresses all primary objectives from issue #28712: explains OAuth loops caused by BUILT_NEXT_PUBLIC_WEBAPP_URL mismatches, clarifies ALLOWED_HOSTNAMES format, documents build-time vs runtime configuration, and provides troubleshooting steps and verification commands.
Out of Scope Changes check ✅ Passed All changes are confined to Docker documentation in docker.mdx and directly address the troubleshooting guidance needed for issue #28712, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/docs/content/docker.mdx (1)

111-111: Clarify when the NEXTAUTH_URL=http://localhost:3000/api/auth workaround applies.

As written, this reads as a general fix, but pointing NEXTAUTH_URL at localhost will break OAuth provider callbacks for users on a real public domain (providers redirect back to the URL derived from NEXTAUTH_URL). Consider scoping this guidance to the specific scenario in the accompanying log snippet — a container that cannot resolve its own public hostname from inside (e.g., split‑horizon DNS / testing.localhost) — and explicitly note that production deployments with a real OAuth provider should keep NEXTAUTH_URL set to the public domain.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/docs/content/docker.mdx` at line 111, Clarify that the
NEXTAUTH_URL=http://localhost:3000/api/auth suggestion only applies to the
specific scenario shown in the log snippet where the server/container cannot
resolve its own public hostname (e.g., split‑horizon DNS, testing.localhost, or
container loopback), and not to production OAuth setups; update the text to
state: when the container's internal DNS cannot reach the public domain, you can
set NEXTAUTH_URL to the internal callback URL (e.g.,
http://localhost:3000/api/auth) while keeping NEXT_PUBLIC_WEBAPP_URL on the
public domain, but emphasize that for real public deployments and OAuth
providers the NEXTAUTH_URL must remain the public domain so provider redirects
work correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/docs/content/docker.mdx`:
- Line 122: The docs example for ALLOWED_HOSTNAMES is inconsistent with the
actual parsing (JSON.parse(`[${process.env.ALLOWED_HOSTNAMES || ""}]`) in
packages/lib/constants.ts); update the example in the documentation to show
ALLOWED_HOSTNAMES as a comma-separated list of quoted strings so it parses
correctly (for example:
ALLOWED_HOSTNAMES='"cal.example.com","www.cal.example.com"'), ensuring the doc
uses the same quoted-string format as .env.example.

---

Nitpick comments:
In `@apps/docs/content/docker.mdx`:
- Line 111: Clarify that the NEXTAUTH_URL=http://localhost:3000/api/auth
suggestion only applies to the specific scenario shown in the log snippet where
the server/container cannot resolve its own public hostname (e.g., split‑horizon
DNS, testing.localhost, or container loopback), and not to production OAuth
setups; update the text to state: when the container's internal DNS cannot reach
the public domain, you can set NEXTAUTH_URL to the internal callback URL (e.g.,
http://localhost:3000/api/auth) while keeping NEXT_PUBLIC_WEBAPP_URL on the
public domain, but emphasize that for real public deployments and OAuth
providers the NEXTAUTH_URL must remain the public domain so provider redirects
work correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 92dac396-9e3e-4a0f-bb2c-a6919b1b6f84

📥 Commits

Reviewing files that changed from the base of the PR and between 9efd0e6 and c31f46e.

📒 Files selected for processing (1)
  • apps/docs/content/docker.mdx

Comment thread apps/docs/content/docker.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added the Stale label Apr 24, 2026
@jeevan6996
Copy link
Copy Markdown
Author

Thanks for the nudge — this PR is still active and ready for review.\n\nThe docs updates are complete from my side; the remaining blocker is maintainer-side CI gating for external contributors. If a maintainer can apply , I’ll address any follow-up quickly.

@jeevan6996
Copy link
Copy Markdown
Author

Correction: this PR is still active and ready for review.\n\nThe docs updates are complete from my side; the remaining blocker is maintainer-side CI gating for external contributors. If a maintainer can apply the run-ci label, I’ll address any follow-up quickly.

@jeevan6996
Copy link
Copy Markdown
Author

Addressed one concrete bot finding in a follow-up commit (): updated the troubleshooting example for to the quoted-string format expected by parsing logic (matching ).

@jeevan6996
Copy link
Copy Markdown
Author

Correction: addressed one concrete bot finding in follow-up commit 5caa8ea. Updated the troubleshooting example for ALLOWED_HOSTNAMES to the quoted-string format expected by parsing logic, matching .env.example.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/docs/content/docker.mdx`:
- Line 123: Update the documentation for NEXT_PUBLIC_WEBAPP_URL to state it must
be a full URL including the scheme (e.g., https://cal.example.com) rather than
just a hostname; change the phrase "public domain" to something like "full
public URL (including http:// or https://)" so derived auth URLs are not
malformed and readers know to include the scheme.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: abcd6a58-62d0-44bb-8e70-4e157804116f

📥 Commits

Reviewing files that changed from the base of the PR and between c31f46e and 5caa8ea.

📒 Files selected for processing (1)
  • apps/docs/content/docker.mdx

If OAuth loops and logs show messages like `Match of WEBAPP_URL with ALLOWED_HOSTNAMES failed`, verify all of the following:

1. `ALLOWED_HOSTNAMES` is set as a comma-separated list of quoted hostnames (for example, `ALLOWED_HOSTNAMES='"cal.example.com","www.cal.example.com"'`).
2. `NEXT_PUBLIC_WEBAPP_URL` is set to your public domain.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify NEXT_PUBLIC_WEBAPP_URL as a full URL (with scheme).

Line 123 says “public domain,” which can be read as hostname-only. Please make it explicit that this must be a full URL (for example, https://cal.example.com) to avoid malformed derived auth URLs.

✏️ Suggested doc tweak
-2. `NEXT_PUBLIC_WEBAPP_URL` is set to your public domain.
+2. `NEXT_PUBLIC_WEBAPP_URL` is set to your public URL (for example, `https://cal.example.com`).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/docs/content/docker.mdx` at line 123, Update the documentation for
NEXT_PUBLIC_WEBAPP_URL to state it must be a full URL including the scheme
(e.g., https://cal.example.com) rather than just a hostname; change the phrase
"public domain" to something like "full public URL (including http:// or
https://)" so derived auth URLs are not malformed and readers know to include
the scheme.

@jeevan6996
Copy link
Copy Markdown
Author

Quick status update: docs changes are complete and I addressed the actionable bot feedback in the latest commit. The current blocker is the required external-contributor CI gate; if a maintainer can apply the run-ci label, I can address any follow-up quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working size/S Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker self-host: OAuth loop + WEBAPP_URL mismatch despite correct env (BUILT_NEXT_PUBLIC_WEBAPP_URL stuck on localhost)

1 participant