etherai / selfhosted-gateway

Self-hosted Docker native tunneling to localhost. Expose local docker containers to the public Internet via a simple docker compose interface.
https://fractalnetworks.co
GNU Affero General Public License v3.0
1.32k stars 66 forks source link

Add support for App-Subdomain-Domain-TLD #30

Closed Baestus closed 9 months ago

Baestus commented 9 months ago

Previously, if a domain used the format app.subdomain.domain.tld, entrypoint.sh would fail to rename the docker images correctly. A domain like this: app.subdomain.domain.tld
will be named subdomain-domain-tld

creating a duplicate container name error if attempting to host multiple services using that gateway.

This adds a higher string slice [-3:] -> [-4:] which now correctly names app level domains as app-subdomain-domain-tld. It also adds the app name to the nginx.conf.template, which will correctly parse app-subdomain-domain-tld.

I ran into this issue with a duckdns domain, which looks like the following: app.mydomain.duckdns.org, making all my containers named mydomain-duckdns-org, causing duplicate container issues.