Firewall?

I am super new to web app and xc but i have a decent little web app deployed I think Im in a firewall out situation, but…? This app basically makes a few api calls to other sites and coordinates some activity between. The first thing it does is to call out to one server’s api for some data it displays in a combo box. Then, the user can select one of the entries and it does this coordination bit - asking one api for data on the left and posting it to another server’s data on the right where it gets displayed. The first call out to the outside server runs fine and displays the combo of data. Then when I select an entry its not doing what it does in the local server - running some similar coordiantion back and forth to other api endpoints of the outside servers, coordinating some activity. Its working fine on my local server. The peculiar thing is I would have expected all the api calls to need to be wrapped in the firewall.open() function to work but the 1st outbound call doesnt seem to need it? I guess I should mention that this app’s desktop version runs like a top.

You can open ports at runtime:

https://documentation.xojo.com/api/xojocloud/firewallport.html

Right, thanks Greg. I did mention I saw that above but why would the 1st call out to an api work and not the subsequent calls? No big deal, I will wrap those up but i thought it was unexpected.

Make sure the variable you are using stays in scope and doesn’t get destroyed because the port will automatically close if that happens.

DO you mind if I tag along on this thread? Firewalls and Xojo Cloud.
Ive just got a new cloud account.

But Im still using an external cubesql server as its with Phillip and the license is part of the hosting.
I may upgrade the code later to MySQL and keep it all here, but for the moment my data is on a separate server (for better or worse)

I get the open a firewall port…idea. ie
Dim fwp As New XojoCloud.FirewallPort(3306, XojoCloud.FirewallPort.Direction.Outgoing)
fwp.Open() // This call is synchronous

But I have no idea how to direct my app to use this port to access my server?
ie the PORT on the cubesql server I believe is ITS port that I talk to so not relevant here.

dim db as new CubeSQLServer
db.Host = “server.host”
// not useddb.Port =
Please how do I tell my CubeSQLServer to use your firewall port?
Im Totally lost.
PS the webapp has worked well for years in current environment. So I’m just stuck on this new issue for me.
Many thanks for any help here.

First of all, don’t declare the firewall variable in code. It’ll most likely go out of scope and close before you can use it. Make it a property somewhere and open it once.

The port number is the port that the cubesql server is listening on… but keep in mind how incredibly dangerous it is to expose a database server directly to the internet. If there were any flaws in the engine, a hacker will find and exploit them. You’d be better off creating a web api which interacts with it. CubeSQL is just another TCP protocol, so there must be a port number in use somewhere.

The direction of the firewall port is the direction of the connection, in this case OutGoing, because your Xojo Cloud server is connecting to another server.

Something else though. CubeSQL is just sqlite under the hood. You could probably just use a local SQLiteDatabase file with WriteAheadLogging turned on.

Excellent Greg
I’ll give it a shot.
Thanks