NancyFx/Nancy — pull request #1005 by timplourde (2013-02-21 03:33:30+00:00)
Title: Remove original port number when redirecting to HTTPS

INancyModule.RequiresHttps(true) should strip the port number on the original URL when building the HTTPS redirect URL by default, with an overload to specify a HTTP port number.

You can see the current behavior on this Windows Azure Web Site:

Site: http://wawsnancyssl.azurewebsites.net/
Source code: https://github.com/timplourde/wawsnancyssl

Notice how the redirect preserves the :80 port number from the original request. This is not an Azure thing- it happens on local IIS too.

ASP.NET's MVC doesn't have this issue its [RequireHttps] attribute drops the original URL's port number:
http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/1acb241299a8#src/System.Web.Mvc/RequireHttpsAttribute.cs

In this PR, RequiresHttps(true) will strip off the port number by default and provides an overload to specify a HTTPS port number if so desired.