Handling port based InApp Host redirect Dynamically

Similar to this here Handling DNS based InApp Host redirect - Development - NethServer Community

How can i achieve this for NS8 modules,

127.0.0.1 hostname.domain.tld
127.0.0.1 hostname2.domain.tld

IF the Given App supports handling this.

How could something like this be implemented within the confines of NS8.

for each new site hostname create, a port is defined for it.

hello @davidep any ideas on this

Could you please provide more context about the issue you’re trying to address?

Port based multitenancy
You can create a new site and make run it on a different port (while the first one runs on port 80).

Switch off DNS based multitenancy (once)

bench config dns_multitenant off

Create a new site

bench new-site site2name

Set port

bench set-nginx-port site2name 82

Re generate nginx config

bench setup nginx

Reload nginx

sudo service nginx reload

While above are specific to ERPNEXT and frappe, We have other apps which we have bene working on, that have forced us to ask this question.

How can a NS8 admin user, dynamically a hostname to a newsly exposed App port, and have it functioning within the apps confines.

Assume i impelemnt,

--label="org.nethserver.tcp-ports-demand=10" \

and define a port range for the app.

WHile, by default, the app exposes a default port, all other sites, using their own variations of ports, that could be exposed for use

Note i am also trying to avoid this

# ... removed for brevity
services:
	# ... removed for brevity
  port-site-1:
    image: frappe/erpnext:v14.11.1
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - nginx-entrypoint.sh
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: site1.local
      SOCKETIO: websocket:9000
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    ports:
      - "8080:8080"
  port-site-2:
    image: frappe/erpnext:v14.11.1
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - nginx-entrypoint.sh
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: site2.local
      SOCKETIO: websocket:9000
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    ports:
      - "8081:8080"
  port-site-3:
    image: frappe/erpnext:v14.11.1
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - nginx-entrypoint.sh
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: site3.local
      SOCKETIO: websocket:9000
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    ports:
      - "8082:8080"

As documented here frappe_docker/docs/port-based-multi-tenancy.md at main · frappe/frappe_docker (github.com)