fix: resolve state directory under sudo and detect WSL2 mirrored networking#286
Open
gerardbalaoro wants to merge 2 commits intovercel-labs:mainfrom
Open
fix: resolve state directory under sudo and detect WSL2 mirrored networking#286gerardbalaoro wants to merge 2 commits intovercel-labs:mainfrom
gerardbalaoro wants to merge 2 commits intovercel-labs:mainfrom
Conversation
|
@gerardbalaoro is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
When the proxy starts with sudo, os.homedir() returns /root, so the proxy used /root/.portless for state. But child apps run as the normal user and write to /home/<user>/.portless. The proxy never saw route registrations because they lived in different directories. Use SUDO_USER + getent passwd to resolve the original user's home directory so both proxy and apps share the same state directory. Fixes vercel-labs#283
Detect WSL2 via /proc/version and check mirrored networking status with wslinfo CLI. Print setup instructions only when WSL2 is detected and mirrored networking is not configured, so Windows browsers can reach the proxy via localhost. Update README and SKILL.md with WSL2 setup documentation. Refs vercel-labs#283
223589d to
95e1a0f
Compare
|
Hi @gerardbalaoro , Thanks for your PR, I've added a comment in the linked issue thread: #283 (comment) |
Anyway it seems reasonable to merge this PR if it resolves the routing issue, even though it doesn’t address the SSL problem. Since it now works with NAT, I wonder if the warning is still applicable.
|
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.

Two fixes for Linux/WSL2 environments. Closes #283.
1. State directory under sudo (
packages/portless/src/cli-utils.ts)When portless is run under
sudo,os.homedir()returns/root, so the proxy and child processes disagree on where the state directory lives. This patch resolves the original user's home directory viagetent passwd $SUDO_USER, falling back to/home/$SUDO_USER.2. WSL2 mirrored networking warning (
packages/portless/src/cli-utils.ts,cli.ts,README.md,skills/portless/SKILL.md)Detects WSL2 via
/proc/versionand checkswslinfo --networking-modeto see if mirrored networking is enabled. If not, prints a warning with setup instructions when the proxy starts. Also documents the requirement in the README and SKILL.md.