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

[WSL]: Clicking on http://localhost:3000 in the terminal translates into loopback, 127.0.0.1 in Windows. #9881

Closed
aidan-rypens opened this issue May 13, 2024 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster wsl Issue in vscode-remote WSL

Comments

@aidan-rypens
Copy link

aidan-rypens commented May 13, 2024

Type: Bug

Cannot seem to find any configuration that would result in this. Suddenly started occuring.
Only occurs using VSCode. Clicking a link in the terminal (using WSL) results in the correct link.

Only specifically applies to localhost.

Extension version: 0.88.2
VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:13:33.891Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 5.15.146.1-microsoft-standard-WSL2

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i9-12900K (24 x 3187)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 63.78GB (47.27GB free)
Process Argv --crash-reporter-id 5042389b-46f0-421e-b14e-d2a5f0e8fa45
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-22.04
OS Linux x64 5.15.146.1-microsoft-standard-WSL2
CPUs 12th Gen Intel(R) Core(TM) i9-12900K (24 x 3187)
Memory (System) 31.23GB (29.22GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
tftest:31042121
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrp:30673768
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelc:31018788
dsvsc021:30996838
g316j359:31013175
pythoncenvptcf:31043158
fchga941:31046352
pythonprc:31039816
dwnewjupytercf:31039676

@VSCodeTriageBot VSCodeTriageBot added the wsl Issue in vscode-remote WSL label May 13, 2024
@aeschli
Copy link
Contributor

aeschli commented May 14, 2024

Can you explain more?

  • you have http://localhost:3000 as a string in the integrated terminal and click on it
  • the browser opens but opens 127.0.0.1 ?

@aeschli aeschli added the info-needed Issue requires more information from poster label May 14, 2024
@aidan-rypens
Copy link
Author

Can you explain more?

  • you have http://localhost:3000 as a string in the integrated terminal and click on it
  • the browser opens but opens 127.0.0.1 ?

Exactly that behavior. Correct.

@aeschli aeschli assigned Tyriar and unassigned aeschli May 15, 2024
@viell-dev
Copy link

I've had the same problem for a long time. The app I'm working on talks with an ID server that doesn't have loopback IP's in it's CORS settings but does have localhost. So signing in only works through localhost.

Ended up just putting this in my main.ts file:

if (location.hostname.startsWith("127.")) {
  location.hostname = "localhost";
} else {
  // Actual main code goes here.
}

Here's a step-by-step visual guide to what is happening:

Terminal shows https://localhost:8000
Terminal shows https://localhost:8000

Hovering on the "Follow link" text shows https://localhost:8000
Hovering on the "Follow link" text shows https://localhost:8000

Ports panel shows 127.0.0.1:8000
Ports panel shows 127.0.0.1:8000

Browser opens at https://127.0.0.1:8000
Browser opens at https://127.0.0.1:8000

@aidan-rypens
Copy link
Author

@viell-dev
image

Thanks for pointing out the screen. I don't have the same configuration but suddenly the URL matches localhost again and not loopback.

However, the values configured in ports (screenshot) are still the same as before. So an update from VSCode might have solved it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster wsl Issue in vscode-remote WSL
Projects
None yet
Development

No branches or pull requests

5 participants