microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.67k stars 290 forks source link

[Feature] Let us define localHost and localIp for remote.SSH.defaultForwardedPorts #4029

Closed NicolasGoeddel closed 3 years ago

NicolasGoeddel commented 3 years ago

It is already possible to define some ports which should be forwarded from the remote machine to my local machine like so:

        "settings": {
        "remote.SSH.defaultForwardedPorts": [
            {
                "localPort": 8080,
                "remotePort": 8080,
                "name": "client1"
            }
        ],
        "remote.restoreForwardedPorts": true,
    }

Now if I click on the little world icon in the Remote Explorer the address http://127.0.0.1:8080 will open. image In my case this is not working because my application won't work properly if there is no hostname. Because of that I would like to see the entry localHost and localIp to define to what address the world icon will lead me and to which local IP address the port will be bound. The simplest case would be to send me to the URL http://localhost:8080 instead of http://127.0.0.1:8080.

roblourens commented 3 years ago

Should the remote host be customizable as well? I suppose so...

roblourens commented 3 years ago

Oh, the local host is not customizable by the method we use, @alexr00 is that because of cases like codespaces where someone else has to determine the local host? Could we set a local host that might be ignored, or is there another reason that it's not customizable?

alexr00 commented 3 years ago

@roblourens we just try to copy the remote host (it can only be 127.0.0.1 or localhost). It looks like you're using 127.0.0.1 by default. Could you just use localhost?

roblourens commented 3 years ago

Oh I see. I just used 127.0.0.1 because I've had issues with localhost not being what you expect in certain situations. Do other remote flavors use localhost?

NicolasGoeddel commented 3 years ago

I am developing Plone addons and somehow it does not like raw ip addresses as host. It then just does not load any CSS and JS files. If I use localhost it works correctly.

alexr00 commented 3 years ago

Remote Containers is using localhost because of microsoft/vscode-remote-release#2711, so it looks like the safer option. If it turns out that we do need to be able to set it we can add api later.

roblourens commented 3 years ago

I'll just match that and use localhost.