Skip to content

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

Open
jeevan6996 wants to merge 4 commits into
calcom: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 into
calcom: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

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5f1184f-292e-426b-a843-6aa290dd0f45

📥 Commits

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

📒 Files selected for processing (1)
  • apps/docs/content/docker.mdx
✅ Files skipped from review due to trivial changes (1)
  • apps/docs/content/docker.mdx

📝 Walkthrough

Walkthrough

The Docker documentation was updated with expanded self-hosting troubleshooting for OAuth hostname mismatches. CLIENT_FETCH_ERROR guidance was reworded to state the Auth callback uses the web app URL and to recommend setting NEXTAUTH_URL (e.g. http://localhost:3000/api/auth) for internal callbacks while keeping NEXT_PUBLIC_WEBAPP_URL set to the public domain (including scheme). A new WEBAPP_URL and ALLOWED_HOSTNAMES mismatch section lists verification steps and adds a runtime check to print BUILT_NEXT_PUBLIC_WEBAPP_URL inside containers, with a rebuild/restart instruction if it still contains http://localhost:3000.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: documentation for Docker OAuth/webapp URL mismatch troubleshooting.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of the documentation additions and referencing issue #28712.
Linked Issues check ✅ Passed The PR addresses all key objectives from issue #28712: clarifies NEXT_PUBLIC_WEBAPP_URL build-time requirements, explains BUILT_NEXT_PUBLIC_WEBAPP_URL hostname mismatches, documents ALLOWED_HOSTNAMES format, provides troubleshooting steps and verification commands.
Out of Scope Changes check ✅ Passed All changes are documentation-only (docker.mdx) directly addressing OAuth troubleshooting and hostname mismatch issues; no out-of-scope changes detected.
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

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

Comment thread apps/docs/content/docker.mdx Outdated
@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.

@jeevan6996 jeevan6996 force-pushed the docs/28712-docker-webapp-url-mismatch branch from 5caa8ea to 4d44f68 Compare June 6, 2026 21:45
@jeevan6996
Copy link
Copy Markdown
Author

Addressed the remaining CodeRabbit docs feedback: NEXT_PUBLIC_WEBAPP_URL is now described as a full public URL including the scheme, with an explicit example. The PR still appears blocked by the external-contributor run-ci gate, so a maintainer will need to apply run-ci for the full matrix to run.

@github-actions github-actions Bot removed the Stale label Jun 7, 2026
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

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