Access via Windows VM on NAT (VirtualBox)

So I had recently setup a new server, and put the first of my new staging sites on it. Everything seemed fine, every device I visited the site on worked fine. I then started up the Windows VM's from Microsoft for testing in old version of IE in VirtualBox. Went to access my site, nothing.

I went to other sites and they all worked. Now I was troubled, it likely wouldn't be an issue in production but it still bothered me that my new server wasn't working under the Windows VM. Well not exactly nothing, IE10 was throwing up a 'We couldn't load this page' error or some such and Firefox was showing 'Connection reset by peer' errors.

First I added an Ubuntu 16.04 VM in VirtualBox and got that connected via NAT in VirtualBox and that loaded the site fine. So, I started doing some packet sniffing on the Windows VM and compared the packets to that of my old server, and there were a handful of differences in the request and response headers but the one that caught my eye was that it was requesting 'Keep-alive' but the response 'Connection' was always 'close'. So I go back and check my Apache configuration and Keep-Alive was off. I can't remember if it was on by default on Apache 2.2 but on 2.4 it would appear not. So I switched it on and low and behold, after restarting Apache, the Windows VM's connected via NAT in VirtualBox would now shows the new site perfectly fine.

So, in conclusion, for some reason the Windows VM's using NAT in VirtualBox wouldn't load (or would prematurely drop the connection and I presume further packets resulting in browsers bowing an error?) sites on my server if 'Keep-Alive' was disabled. I intended to use 'Keep-Alive' settings anyway, so it's of little consequence to me. It may have been a bit annoying if I didn't intend on using it, but even then there's no reason it shouldn't work, and indeed every physical device I tested on was fine, so I can only presume it is some bug or some issue with the Windows VM's using the NAT to connect to the internet in VirtualBox.

Anyway, I thought I'd post this up here as it had me pulling my hair out for hours and if it prevents just a single person from doing the same then it will have been worthwhile!

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct