Fix static hosting domain fallback for self-hosted custom domains#3382
Merged
Salazareo merged 1 commit intoJul 15, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: Fix static hosting domain fallback for self-hosted custom domains (#3380)
Description:
Fixes #3380
Root cause
dev-center.js only remaps window.static_hosting_domain away from the hardcoded public default (puter.site) when window.domain === 'puter.localhost'. Any self-hosted instance running on a real custom domain falls through to puter.site, which doesn't exist on that network — so the Dev Center's "Give it a try" flow 404s after deploying via Apps → Deploy → Use files.
I also investigated the middleware side, since the original issue included a hostRedirects.js patch. hostRedirects.ts already guards against this correctly — createUserSubdomainRedirect's hostingDomains.some(...) check passes through requests already on the target hosting domain, preventing the redirect loop. So no change was needed there; the gap was isolated to the frontend fallback logic.
Fix
Added an else if branch so any self-hosted instance with a real custom domain (not puter.localhost, not puter.com) derives its static hosting domain as site. instead of falling back to the public puter.site.
Testing
Reproduced the original 404 on a self-hosted instance with a custom domain following the exact steps in #3380.
Confirmed the fix resolves it — after the change, deployed apps load correctly via "Give it a try."
Verified file syntax with node --check src/dev-center/js/dev-center.js.
Wasn't able to run the full local npm run build, since this repo requires Node ≥24 and I'm on Node 22.14.0 locally — will rely on CI to validate the full build/test suite. Happy to upgrade and re-verify locally if maintainers would prefer that before merge.