Multiple ports with public URL?

support

#1

Resin.io exposes port 80 with a static public URL: https://docs.resin.io/management/devices/#enable-public-device-url

I have services which use multiple ports. For example, a simple static web app served on port 80 which communicates to an API over another port.

How can I accomplish this with Resin.io?


#2

Hi, that’s currently not possible though the Public URL to expose more than one ports.

In your particular case, I’d probably assemble your app such, that both the web app and the API are on the same port, but the API is namespaced with e.g. an /api/ path. Many setups do this readily (e.g. Python/Flask apps that I’ve used combined dynamic APIs and static web apps readily). This of course works easier if the whole app is the same framework. If not, then might need a server in front of the status app and the API to do the redirects (caddy or nginx, for example).


#3

Thank you for your prompt reply!

This is unfortunate. Using the same port with nginx routing requests to different namespaces (e.g. /api/ path) is a good idea. However, in some cases I do not have control over this. For example, the Deluge BitTorrent server uses a port for the web app, and separate ports for the APIs: https://github.com/Glavin001/resin-deluge I do not think I have control to configure the clients to send requests to :80/api/ and instead only can change the port number.

Is this a feature planned in the future, or something Resin.io does not expect to support?


#4

As I’ve quickly tried deluge-web, I think it’s connecting to the server through the localhost. So I’m guessing in this particular case you don’t actually need to expose any other port, but move the default deluge-web port from 8112 to 80. Might be wrong about it, but the web interface didn’t seem to connect to any other port. Might worth a bit more checking out. :mag:

It is not currently planned, but will be discussing this possibility!


#5

Yup, I have deluge-web port serving on 80. However, deluge itself uses other ports for connecting with the a “thin client” remotely, such as the “daemon_port”: https://github.com/Glavin001/resin-deluge/blob/master/core.conf#L13

So far deluge-web has been great and works flawlessly – it’s API is over port 80 as well using an endpoint /json. The thin clients are the only feature I lack when I am away from home.

Thanks for looking into it! Hopefully something Resin.io team can consider :slight_smile:.


#6

Ah, so if I understand now, you are using both deluge-web and the thin clients, that’s why you need two ports accessible? deluge-web uses that port too, but it can do it within the localhost, so wouldn’t need any extra ports.

Yeah, will keep you posted if there’s any development regarding this feature.