Testing pen - Mobile app connecting to a local database

Hi there,

I am not sure if this is a Wappler issue, and hence the question.

I am working on a mobile app which needs to fetch data from a remote server. For testing purposes, the remote server runs on a local machine. Both machines have access to the WiFi router, so they can both access internet.

Is there a way to get the mobile app to access the local server via WiFi without going over to internet?

Thanks for your help.

Hi @tomcat,
You’ll need to have a local webserver up and running and configure port forwarding within your specific router if not already enables. Rather than me re-writing guides its easy enough to find one via a search engine on how to do this. On the Wappler side you will need to have the Project set up to use the local web-server and deploy all your files and database to it. Try to replicate your online environment as best you can, ie run the same PHP and MySQL versions. You may also need to check for any firewall restrictions on your local host to insure the connections can be routed. Shouldn’t be too difficult to figure out, maybe an hour or so if this is your first attempt at doing such a set-up.

Results on setting up the environment

WAMP

Port Forwarding

Hope that helps get you started.

1 Like

Ok, I updated Apache’s httpd.conf with:

Listen 30405
ServerName localhost:30405

AllowOverride All
Require all granted

I then enabled port forwarding in my router mapping port 30405 to localhost . I saved it and restarted the router.

I restarted the Apache and can see that my port is available.

Now I try to access the site from a browser (running on a different machine but on the same WiFi network), I get an error:

“This site can’t be reached”

Have I missed any step?

Thanks

Could be your firewall? Couple of quick web searches provide the following:

Windows Defender Firewall

Mac

Linux

You may also have to configure a DMZ on your router. Try a search for your routers manufacturer with DMZ in the search criteria. Usually throws up the answer. Try the above firewall options first though…

1 Like

Ok, great. I think I am there now.

Using the windows settings in Networks and Connections

I had to change the network profile from “public network” to “private network” which makes the device discoverable by other machines.

Then selecting the “private network”, I had to turn of the Microsoft Firewall Defender for the private network. This then allowed the PC be visible to other machines, and any request to port 30405 was then redirected to the server running on the PC.

Now I can see the server from another machine. I even tested that from a mobile browser, so that works too.

Thank you very much for your help :slightly_smiling_face:. This makes my testing a lot easier now.

1 Like

You are very welcome @tomcat. Happy to hear you have everything working.

:slight_smile:

You are welcome :+1:

Now you can use SQLite for your mobile and desktop projects: Using Local Databases in Mobile and Desktop apps

This topic was automatically closed after 24 hours. New replies are no longer allowed.