How to access localhost on another pc

I’m a developer and in my day to day, I need to access my application locally. The famous localhost:3000.

But when I used Manjaro, it was possible to access my localhost on another pc through the same network.

For example pc-ip/3000. Now I needed to use Windows with Arch WSL and I can no longer access my localhost on another pc. Is it possible to do that?

This is not at all related to Manjaro. In any case, it should be possible, you need to check the firewall settings.

For clarifying sake:

  • localhost is (usually set as) an alias for IP 127.0.0.1, which is the standard IP for pointing the local machine.
  • Thus, accessing the “localhost on another pc” is actually accessing a server on another machine, either through its network name or (network bound) IP.
  • Accessing a web server from another machine requires that the server machine allows inbound connections.

So, in order to access a distant web server, you need to

  • check the network name / IP and port used is correct
  • check the web server allows inbound connections (which may not be the default)
  • check the server machine allows inbound connections, as @pobrn suggested

https://wiki.archlinux.org/title/Network_configuration

You have never done that.

localhost = 127.0.0.1 = non-routable address

Which ever environment you use, bind the service to 0.0.0.0:5000 - then you can access from another system - suffice no firewall is active.

1 Like

I don’t understand, how would I do that?

Are you? Which framework is it?

Front-end, React.

And which server? There will be a config where you can set the IP.

How so which server?

If i follow the documentation, React is a pure JavaScript library to embed within HTML pages. This means that one doesn’t actually need to deploy a React application to run it, simply open the page containing it in your web browser.

That said, if you want to have your page accessible outside your machine, you need to deploy your page on a web server.
Alternatively, since it doesn’t actually need a server to run, you can make your page accessible from other systems through network sharing, like any other file:

You are no developer but a script kiddie.

1 Like

You can forward port via ssh.

https://wiki.archlinux.org/title/OpenSSH#Forwarding_other_ports

They are accessing on port 3000, so a server must be running on “localhost”.
This is the default port for reactjs applications.