In the future, when draft-ietf-dnsop-svcb-https has gained more adoption, this new DNS record allows specifying different ports. At the moment, Safari on iOS already supports DNS responses like myrouter.com. 300 IN HTTPS 1 . alpn="h2" port=81 ipv4hint=192.168.10.1 and connects to port 81, as I tested with OpenWRT package nsd-nossl_4.6.1-1 that supports that record type. Though most other browsers do not yet implement this.
If memory serves me correctly, the fakeinternet package does something similar with resolving a domain.com to a local IP (192.18.1.1) and then redirecting requests to port 80 on that IP to 192.168.1.1:88.
Obviously you'd have to duplicate everything it does for each additional domain you need hijacked.
put luci back on port 80 and configure the webserver to manage the redirects based off the URL so that myrouter.com redirects to 192.168.10.1:81 and mycloud.com to 192.168.10.1:82. Not sure if uhttpd can do this but nginx certainly can.
If you are using http only and not https then the redirect or reverse proxy should be fairly straight forward to implement.
It may get more complex to also work with https (ssl/tls).
It has been several years since I worked with these issues but another potential solution is to add a secondary IP (alias) and bind one of the http servers to the alias and set DNS names to match if your goal is only for access on the lan. Unfortunately I don't have OpenWrt experience with this to give specific config advice.
As others have noted, you need to configure DNS for domain names.
If you configure DNS with myrouter.com 192.168.10.1 mycloud.com 192.168.10.1
then you can configure lighttpd to respond to them separately
The difference is that a pure HTTP server (acting as a server and not as a proxy) will only be able to serve their own content, while a PROXY can be used in front of different servers.
Hi @eduperez, I am a lighttpd developer and well-versed in HTTP and related protocols, including proxying HTTP.
I'm sorry but I do not understand the point you have been trying to make.
You wrote:
Using NGINX (or other reverse proxy), you can have more than one service on the same address and port.
That could have been written equivalently as
"Using lighttpd or NGINX (or other reverse proxy), you can have more than one service on the same address and port."
Again, I do not see the point you were trying to make, other than possibly that you know how to use nginx. Congrats! So do I. I do prefer lighttpd, though I am a bit biased.