Nginx or Apache as a reverse proxy in front of CloudStack (including VNC console support) #11562
-
Hello, I’m looking for a working configuration for Nginx or Apache as a reverse proxy in front of CloudStack (including VNC console support). I’m currently setting up our first CloudStack cluster and have 3 servers available for this. At the moment, I have a single-node running, and so far, everything is working as expected. VMs can be created, and storage is connected via NFS without issues. The CloudStack Management server is still running on port 8080, and the VNC console is working as well. Now I would like to place Nginx or Apache in front of it. Forwarding port 443 to 8080 is no problem, but I can’t get the VNC console to start when accessed through the reverse proxy. The error message I receive is always: “Failed to connect to server / access token has expired” or “404 not found". Could please someone share their Nginx configuration with me? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Not sure about Nginx or Apache but i'm using HAProxy on pfSense and work pretty well for the console. |
Beta Was this translation helpful? Give feedback.
-
@dR3b Do you use ssl offloading ? |
Beta Was this translation helpful? Give feedback.
-
The biggest issue with a proxy would be the fact that the consolevm and ssvm can spawn multiple instances dynamically so you'd have to do something like a regex match on the server name to extract the ip address of the real backend console or ssvm node. I haven't found a premade example for cloudstack, but openstack has a similar problem and this is their solution: Of course we'd need to parse server_name instead of location, which could be done something like this: |
Beta Was this translation helpful? Give feedback.
-
I’ve created a diagram here to show what I actually want: |
Beta Was this translation helpful? Give feedback.
-
Here’s my NGINX setup (very similar to what @dR3b and @bhouse-nexthop shared). I’m assuming SSL (wildcard cert) is terminated on NGINX for all services:
For small environments (around 10~30 concurrent SysVMs), you can create a host-to-IP mapping that includes the environment name (dev, test, stage, poc, hotfix, etc.)
This setup covers Console Proxy VMs and Secondary Storage VMs:
For WebSocket Secure (WSS) traffic:
Both use the same host-to-IP mapping, without a tailored regex. For larger environments, consider HAProxy, Varnish, or Envoy because they scale better and handle complex routing more efficiently. Warning: Using a loose regex for server_name can expose other network assets (via fuzzing/guessing IPs). Keep the regex strict to SysVMs only. |
Beta Was this translation helpful? Give feedback.
Here’s my NGINX setup (very similar to what @dR3b and @bhouse-nexthop shared).
I’m assuming SSL (wildcard cert) is terminated on NGINX for all services:
For small environments (around 10~30 concurrent SysVMs), you can create a host-to-IP mapping that includes the environment name (dev, test, stage, poc, hotfix, etc.)