var request = req.OriginalRequest as HttpListenerRequest;
if (request != null)
{
if (IsIPAddress(request.Url))
{
string correspondingHostName;
if (RedirectMap.TryGetValue(request.LocalEndPoint.Address.ToString(), out correspondingHostName))
{
var builder = new UriBuilder(request.Url);
builder.Host = correspondingHostName;
return new RedirectHttpHandler { AbsoluteUrl = builder.ToString() };
}
}
return null;
}
throw new HttpError(HttpStatusCode.BadRequest, "Cannot respond to request");
Returning the RedirectHttpHandler results in the 302 code being sent back to the client.
In my scenario I would want a permanent redirect / the 301 code.
That’s not going to be till next release which will be a while as we only just deployed last week. If you need it now you’ll need to fetch the pre-release packages that’s on MyGet.