devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.31k stars 361 forks source link

Consider binding to localhost instead of 127.0.0.1 #2409

Open withinboredom opened 1 year ago

withinboredom commented 1 year ago

https://github.com/loft-sh/devspace/blob/596b007df4b4d7cbaafb188ee48295d68ebcf599/pkg/devspace/server/port_forward.go#L94

With the prevalence of ipv6-only networks growing (and allowing this to work in environments like WSL), can you please consider binding to localhost instead of a hardcoded ipv4 address?

FabianKramm commented 1 year ago

@withinboredom thanks for creating this issue! We have an option to override this with:

dev:
  my-dev:
     ports:
    - port: 8080
      bindAddress: "localhost"
alexandradragodan commented 1 year ago

Hei, @withinboredom.

Does the suggested workaround work for you, for now?

withinboredom commented 1 year ago

Yes, the workaround works for me. What is the behavior of this option for reverse port forwarding? It doesn't seem to work in my network (binding to localhost, ::1, or another IP in my network doesn't seem to do anything).

FabianKramm commented 1 year ago

@withinboredom not sure if this setting makes sense for reverse port forwarding as the listening happens within the container and then a connection to the localhost is made.