URL Shortener but with subdomains instead? reddit / selfhosted ---------------------------------------------------------------------- thebotnist · 2023-12-14 01:37 I'm looking to see what's out there to help me with "vanity URLs". When I say "vanity URL", I mean being able to setup sub domains to redirect people to various services I host. So for example, http://wiki.mydomain.com does a 302 redirect to to https://atlassian.net/mydomain/wiki. Another one might be https://app.mydomain.com that redirects to https://my- app.westeurope.azurecontainer.io:8443/login Think like a url shortner but with subdomains instead of in the path section of the URL This are very simplified examples. You can assume https is handled properly on the sites my "vanity URLs" are redirecting them to. Right now I have a simple NGINX server that listens for those subdomains and 302 redirects them to the appropriate site, however I'm a little tired of having to manage confs for new domains, keep on top of container/sw updates, and I also don't have https enabled. It's running in a cheap container service and I don't feel like figuring out how to make LE work with it right now. ---------------------------------------------------------------------- thekrautboy · 2023-12-14 02:16 Use a reverse proxy, if you want one with a WebUI to configure look at /r/NginxProxyManager ---------------------------------------------------------------------- thebotnist · 2023-12-14 02:18 I guess that's sort of what I'm doing now with NGINX. My site confs are just reverse proxy configs. Nginxproxymanager looks cool, hadn't seen this before, thanks I'll check it out! ---------------------------------------------------------------------- NikStalwart · 2023-12-14 02:53 > Right now I have a simple NGINX server that listens for those subdomains and 302 redirects them to the appropriate site This is almost the proper way to do it > however I'm a little tired of having to manage confs for new domains, keep on top of container/sw updates, Such is life. You're going to need to manage some form of config no matter what software you use. > nd I also don't have https enabled. That sounds like a you problem: if you have a publicly-facing nginx server already, you can just use HTTP-01 challenges using a simple LE client like diafygi's acme_tiny. **Proposed Solution** Instead of this fuckery with nginx configs, try the following: * Create a wildcard DNS entry to point *.example.com to your nginx reverse proxy * Use something like acme-hooked (DNS-01-compatible form of acme_tiny) to issue wildcard certificates to your "link shortener" nginx * Write a dead-simple server in nodejs, c#, php or whatever you feel comfortable using. All it needs to do is look at the HTTP 'Host' header, sanitize it (to avoid command injection), then compare it to some dictionary of target hosts * Use nginx to do ssl termination and reverse proxy to your redirect sever I wrote versions of the redirect server in < 15 lines of crystal-lang, golang, node and php back in the day when I did things that way. You only need to maintain the dictionary moving forward.