Preview site on same network, what am I doing wrong?

Hello!
Can somebody help me identify an issue?
When I use node local wappler server I can open the site on other devices like: 192.168.0.X:4000

But with the php local wappler server it works on current device.
On other devices I only see: ERR_CONNECTION_REFUSED

Tested with Xampp on other project and own server and everything works as expected.

It's a bug?
Can somebody using php wappler local server replicate my issue?

Thanks!

Internally, this is the difference between binding to address 127.0.0.1 or 0.0.0.0

A bug or a feature request :slight_smile:

Because if it were me, I'd want to bind to 127.0.0.1, but you want to bind to 0.0.0.0 for other devices to access... But if I'm in public Wi-Fi I don't want others to access my development server, so that's why I don't know how to answer if this is a bug or not

And regarding your question what you're doing wrong, probably nothing, it's Wappler's fault they configured the bind addresses differently

I see indeed that the php local server binds only to localhost so it listens to only 127.0.0.1

I will see if we can change that indeed to 0.0.0.0

I suspect the answer lies in how Wappler have implemented the PHP server within Wappler.

With the node Wappler Own server model you have an actual server running.

With PHP own server, there is not actually a server such as Apache running, the server is simulated within the Wappler environment with reference to the PHP CLI.
Hence it is only available on a local host basis where the CLI is running and not from elsewhere on the network.
Therefor this is probably not a bug but a limitation of the technology used.

The PHP CLI has a built-in server for development purposes since a few years ago :wink:

php -S 127.0.0.1:8000

Yes but my point is i don't think (I will be happy to be wrong) this is available across the network as implemented in Wappler. I see george posted at exactly the same time as me and is looking to resolve that.

Don't really understand this..
On NodeJS server you can access from other devices on same network, or I'm wrong about this?

Indeed
cd www php -S internalip:3000 works as expected
should have tested before, sorry :man_facepalming:t2:

Just to be clear if it was a bug, or it was just me because I have been fighting with two issues related to php cli server and another network driver :slight_smile:

Thanks for all your inputs and @George for confirming!

Feature request about this?

Depends on your system configuration and network/firewall settings and will more than likely require some changes to be made. If you're on the same network, ie a router at home, and the host system is configured to accept connections then you will be able to preview the site (probably in the 192... range). If not then only devices with a local address (127...) will be able to connect to the host.

If you are in an insecure environment the last thing you want is for 'strangers' to be able to find (network scan) and access your application or connect to your device.

This leaves me unsure what this feature is for as 'straight out of the box' in the majority of circumstances it will not work without configuration...? Even if the correct I.P is assigned the host won't accpet it...

1 Like

Thanks @Cheese yes, that's clear, but by "don't understand this" I was refering on @Apple suggestion.
Because actual configuration on nodejs Wappler own server allows local connections :thinking:..
That's the part that got me confused:
I start a nodejs project, start server, then all my devices can access that..

Yes as in 127... You'll need to whitelist the local router DHCP range on your host machine to allow connections from devices connected to the router (more than likely 192...). You may even have to make changes to your router configuration to enable the ports also. It is all dependant on the configuration of the host and the local network.

And I'm agree with that.
Just asking why @Apple says:

If nodejs actual server allows that...
If I'm not misunderstanding things here, he's not ok with allowing 0.0.0.0, because on public wi-fi, everyone has access to it..

But on a nodejs server, it seems, that is already happening that.

Worth reading up on basic networking principles will make a lot more sense.

Everything is host dependant and relies upon its specific configuration of the User/Administrator.

Is also worth looking in to tools like Zero Trust by Cloudflare.

We are both talking about local wappler own server here?

Any server/service on the local network is under the same rule. Host and Client. Host has to be configured to allow a Client to connect before a Client can connect. Doesn't matter if it is Docker, Wappler, WAMP, MAMP, XAMPP, Apache, MySQl yada-yada... All follow the same principle. Your local machine will always connect (the one you are on) but those on a network (shared or otherwise) will need to be whitelisted on the host, and the corresponding ports may also require configuration. Also if you have features like MAC address filtering (usually on the router) they will also require updating.

The point is Wappler team configured the bind addresses differently for PHP and NodeJS.

We don't know if the bug is allowing other devices to access your server, or if the bug is not allowing other devices to access your server. Basically, what you consider a bug I consider a security issue :laughing:

But George will be updating so it binds to 0.0.0.0, so you'll be able to access from other devices :slight_smile:

1 Like

@Cheese I get that, thanks and sorry because I think my main language is forcing me to confuse things here..
What I'm trying to say, just a friendly advice to @Apple about this:

He says he don't want to anybody get access to his server, but by default, without taking care of rules, that's happening already, and it's more an issue of rules than opening a server on 0.0.0.0

Just want to say a friendly advice here, because from what I see, by default, nodejs server is not pointing to 127.0.0.1, right?
If it's not opening on 127.0.0.1 that means, that everybody can access, by default, from everyone on the same network.

I can sense the utter confusion @franse!

The 0.0.0.0 is a wildcard, essentially it is an open door. Many Administrators only allow specified IPs in a Whitelist. I believe myself and Apple are both in the same boat. This would not work on our network, and I'd never allow it. Lets say you have a MySQL server running and you added 0.0.0.0 to the Whitelist. Essentially what you are doing is saying ALL I.P address's can connect to the server. Now I'm not sure on how Wappler spins up its own server but this address is (will be) Whitelisted.

It is:

http://localhost:8100/

Localhost is always 127... And can be found either by IP or localhost.

You know what got me confused? Please again, sorry if I'm not understanding this right

I'm working on a nodejs separated project, not from wappler.
So:

  1. With this:
const hostname = '127.0.0.1';
const PORT = process.env.PORT || 5000;

app.listen(PORT, hostname, () => console.log(`Corriendo en http://${hostname}:${PORT}`));

I can access ONLY from my computer.

  1. With this:
const hostname = '0.0.0.0';
const PORT = process.env.PORT || 5000;

app.listen(PORT, hostname, () => console.log(`Corriendo en http://${hostname}:${PORT}`));

I can access from ANY device.

  1. And If I start a Wappler node server which you say is a localhost

I can access from ANY device

You got my point?

1 Like