How do I redirect subdomains to a different port

Hello everyone
i have set up a reverse proxy (apache) on my main sever (ubuntu) where i have running some services and have a dns as well. i have configurated some vhost and those that redirect to the same server that is dns/proxy work fine. But those vhost that point to another server dont work.


vhost to redirect to truenas since i change the UI port.
here my dns config

It’s difficult to tell just from the images, but when you look up nas-1.yourdomain.cu, does it resolve the actual address of the NAS or of the reverse proxy. You want it to resolve the reverse proxy.

1 Like

seeem to me that resolve the nas address, cus after change the UI port of truenas dont show nothing in browser

<VirtualHost *:80>
	ServerName grafana-prod-1.homelab.cu
	ProxyPreserveHost On
	ProxyAddHeaders On
	ProxyPass / http://127.0.0.1:3000/
	ProxyPassreverse / http://127.0.0.1:3000/
</VirtualHost>

Here vhost config to grafana and work fine, cus the service is in the same server.

Sorry to fall off of this—rough week here. This seems like it’s a DNS entry away from working. Here’s what I think is the current situation (please let me know if I’m wrong):

  • The TrueNAS web-ui is listening on port 8036
  • Is that http or https?
  • You have nas-2 resolving to 192.168.1.108
  • The reverse proxy seems to be at 192.168.1.104

If those last two bits if info are correct, you should adjust your DNS zone to resolve nas-1.homelab.cu to be 192.168.1.104. In order for the reverse proxy to do its job, traffic has to go to it rather than the ultimate destination. If nas-2.homelab.cu resolves directly to TrueNAS, that traffic will never see the reverse proxy.

Same here i hell of almost 2 week, so just now making time to give u thanks to reply and clarification i see now my error.

About points u ask?

  1. YES: truenas UI > port 8036
  2. HTTP
  3. YES: on my dsn setup nas-2 > 192.168.1.108

I made those changes:
FOR MY KODI WEB UI Remote control
In DNS zone a made a alias named kodi pointing to 192.138.1.104
In vhost :

<VirtualHost *:80>
	ServerName kodi.homelab.cu
	ProxyPreserveHost On
	ProxyAddHeaders On
	ProxyPass / http://192.168.1.102:8080/
	ProxyPassreverse / http://192.168.1.102:8080/
</VirtualHost>

And work fine, but when i doing the same for truenas show me a “truenas page” where alert that waiting connect with truenas.

That’s good that it’s bringing you to a truenas page now. That’s progress! My suspicion is there’s some weirdness with using a reverse proxy. Maybe there’s a web sockets component. I don’t know Apache well enough to be helpful on that front, but it might give you a direction to pursue.

Edit: I just did a quick search and found this thread that might be helpful: SOLVED - Reverse Proxy for UI | TrueNAS Community. Buena suerte!