VMware Communities
JDMPGH
Contributor
Contributor

NAT-connected VM hosting a web app -- forwarded port yields a 404 error

For several years now, my organization has been using VMWare Workstation Pro, with NAT-connected VMs, as the QA/Test servers for a web application.  This has worked perfectly for us -- until it didn't.

In my specific issue there are two platforms involved:

(1) "HostMachine1" -- Windows 10, with VMWare Workstation Pro version 16.1.2 build-17966106

(2) "HostMachine2" -- Windows 11, with VMWare Workstation Pro version ​16.2.0 build-18760230

On "HostMachine1", VMWare is running one of our VMs which hosts a web application. The VM has a fixed IP address, uses a NAT connection, and port forwarding is set up to direct traffic on HostMachine1 port 9090 to port 9090 in the VM. With this arrangement I can open a web browser, enter the URL http://HostMachine1:9090/AppName, and get a successful connection to the web application on the VM. This also works using the IP address of HostMachine1, e.g. http://10.1.2.3:9090/AppName (where 10.1.2.3 is HostMachine1's physical adapter IP).  In short, no problem at all, it is working like always.

However, when I exported this VM and imported it to "HostMachine2" -- configuring the NAT adapter and port forwarding to match HostMachine1 -- the URL http://HostMachine2:9090/AppName returns a 404 error.  The connection does not fail, it's just that the forwarded port is somehow not returning the expected web page content.  I have confirmed this by instead using a URL directly connecting to the *VM's* port 9090 -- and this URL returns the expected web page without trouble.  I also get the 404 error if I try using HostMachine2's IP address in place of its FQDN in the URL, so name resolution doesn't seem to be an issue.

I have also checked and confirmed the NAT adapters of the two VMWare instances use the same subnet (192.168.45.xxx), that the Windows 11 firewall is set up to allow connections on 9090, and so forth. This is definitely not a typical connectivity error, otherwise I would see this in the browser. It is definitely a 404, page not found.

The most like suspects seem to be the different platforms (Win version 11 rather than 10, VMWare version 16.2.0 rather than 16.1.2). but regardless of the root cause, I can't understand why it would specifically manifest as a 404 error rather than a straightforward connection failure??  (If it helps or means anything, the web application on the VM is built & hosted using Apache Tomcat.)

Tags (3)
0 Kudos
0 Replies