Just and FYI with HTTPD


So I ran into this issue and was trying to figure it out then the light bulb went off on why it would be happening… so I thought I would post it here for anyone who might run into this or just for myself later on :slight_smile:

Anyhow when using httpd most of the time the normal random port option will work but if you have persistent elements like local storage or indexed DB you need to set a port number, this has been explained a few times in various post, now the odd part comes into play when you have multiple apps.

When using the HTTPD option ( correct me if I’m wrong here ) it will reserve the port, so if you use the same httpd port for multiple apps you will run into issues with it not being able to find the right indexed DB or localstorage items.

Once I change the port to be unique to each app I was building the issue was resolved.

While this may be somewhat of an edge case I thought it was worth mentioning


Maybe some port-sniffing code in our apps would be a good idea to pre-check a port, then set the port programatically at the app-start routines…? The httpd thing is… interesting… for sure.


The proper fix for this would be if Apple & Google were kind enough to allow us to create a per-app virtual network interface to run the httpd on. Then we don’t need to worry about app conflicts and we can have a fixed address & port so that LocalStorage can resolve to the correct db.

The underlying operating systems (Linux, BSD) can already do this, they just don’t provide API support :frowning:

So current status quo is somewhat full of the suck, choose one of:

  1. Nice robust automatic port assignment and conflict resolution.
  2. The ability to use LocalStorage / IndexedDB etc.