Webapp: possible to listen to a (secure) port range?

That should work just fine, it doesn’t matter if the domains are different or belong to different companies. As long as the subdomain points to your application domain, using a CNAME DNS record, it will work.

app.company-foo.comapp.yourdomain.com
app.company-bar.comapp.yourdomain.com
app.company-baz.comapp.yourdomain.com

Each company will have to deal with their certificates, while you just need to deal with the certificate at app.yourdomain.com.

You can get the Host header either in your App.HandleURL or Session.Opening event, whatever you prefer:

// In App.HandleURL event
System.DebugLog(request.Header("Host"))

// Or in Session.Opening event
System.DebugLog(Self.Header("Host"))

1 Like

You can stick a haproxy server in front of your app. It can listen on many ports and IPs and SSL certs and funnel all the traffic to your app on one IP/port. It can add a HTTP header for your app to tell which connection it is. See https://www.haproxy.org/ for more info.

2 Likes

thank you all for these constructive responses.
I mark Ricardo as the solution, but everyone has a good answer.
I will experiment all of these and report here the choosen one !

1 Like

Ricardo that is exactly what we do. We have all our CNAME dns records pointing to our xojocloud load balancer.

We parse Self.Header(“Host”) for the subdomain that was used and open the corresponding database.

1 Like

Thanks for sharing it!