The Curious Case of the ‘Host’ and ‘X-Forwarded-Host’ Headers

January 18th, 2013

Last week, we rolled out a change to the Forward servers that changed the way a few of the request headers were passed to local servers. Today, we’ve rolled out another one.

Originally, when a request to a Forward URL got to the local dev server, the Host header would be the Forward hostname, e.g. This worked great for most people, but created an issue for our customers who use Pow, MAMP PRO, or other virtual host-based setups. To solve this, we made it so that if you Forward a virtual host, the Host header is set to your virtual hostname (e.g., and we added the X-Forwarded-Host header, set to the Forward hostname (e.g.

Later, we discovered another issue when Forwarding a WordPress site that’s running on regular MAMP. Our WordPress plugin looks at the X-Forwarded-Host header to fix the URLs in a Forwarded WordPress site, but we were only setting that header when Forwarding a virtual host. We decided that since Forward is a lot like a proxy, we might as well treat the request headers like one. So last week, we changed it so that the Host header would always be the name of the host being Forwarded, e.g., or localhost, and the X-Forwarded-Host would always be the Forward hostname, e.g.

But soon after we deployed that change, we started getting support emails and tweets about it. Turns out, lots of frameworks and dev servers rely on the Host header to do redirects, dynamically construct URLs, and do many other things.

In almost all of these cases, it’s possible to configure things to work fine, but that’s a lot of hassle for a lot of our customers. And it’s not in the spirit of Forward. So we decided to make one more change.

As of today, when you Forward a site using just the port (i.e. forward 3000), both the Host and the X-Forwarded-Host will be the Forward hostname (e.g. And when you Forward a site using a virtual host (i.e. forward, the Host header will be your virtual host name, and X-Forwarded-Host will be the Forward hostname.

We think this will work for the vast majority of users, without having to do any special configuration on their part.

Let us know if you have any issues!

— The Forward Team