Run two public servers on one IP with OPNSense

Started by 4yi89u, April 24, 2024, 09:17:19 AM

Previous topic - Next topic
Please help me out, I spent the last two days swearing at my computer and following various HAProxy guides with no success. So I figured I'd ask for some help as I am making zero progress in achieving this goal.

Here's my struggle:

I have an XCP-NG box running OPNSense in a VM at 14.0.0.1:1776. I have been running a public facing Server1 for some years with great success, but now I need to run another server.

Server1 is located at 14.0.0.11 and server 2 is located at 14.0.0.22

I want server1.dogs.com to point to 14.0.0.11 and for server2.cats.net to point to 14.0.0.22. I want it to be accessible from WAN.

Both domains are on cloudflare.

So I figure I need some middle man server or plugin to point wan traffic to that will look at it and say: this visitor is going to server1.dogs.com so they are routed to 14.0.0.11 and this other visitor is going to server2.cats.net and he needs to go to 14.0.0.22.

I don't need this middle man to do anything with SSL or load balancing or . I don't care about having SSL on LAN. The servers I have running handle their own SSL. I just need it to see the URL that a visitor is going to and route them to the proper internal IP.

Please advise, what's the easiest way to do this?

I'm open to running a plugin or another VM or really anything.

The Caddy plugin (os-caddy) will probably do what you need. Note that switching the destination based on a hostname/FQDN works for HTTP/HTTPS only and not for arbitrary applications that don't support this concept (host header, SNI).

HTH,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

April 27, 2024, 09:22:24 AM #2 Last Edit: April 27, 2024, 10:18:29 AM by 4yi89u
Thanks, that worked half-way.

I got my second server working. But now my first server which is a docker contained nextcloud refuses to resolve.


edit: never mind figured  it out


had to point to my apache port under handlers

WOOOHOOO!!!

edit2:

I forgot to say, THANK YOU!