Merge pull request #492 from Bitmapped/7.2.0

Fix for U4-5564
This commit is contained in:
Shannon Deminick
2014-10-01 08:57:25 +10:00
2 changed files with 37 additions and 8 deletions

View File

@@ -24,16 +24,30 @@ namespace Umbraco.Core.Sync
if (status == CurrentServerEnvironmentStatus.Single)
{
//if it's a single install, then the base url has to be the first url registered
return string.Format("http://{0}", ApplicationContext.Current.OriginalRequestUrl);
//if it's a single install, then the base url has to be the first url registered. Use HTTP or HTTPS as appropriate.
if (GlobalSettings.UseSSL)
{
return string.Format("https://{0}", ApplicationContext.Current.OriginalRequestUrl);
}
else
{
return string.Format("http://{0}", ApplicationContext.Current.OriginalRequestUrl);
}
}
var servers = UmbracoConfig.For.UmbracoSettings().DistributedCall.Servers.ToArray();
if (servers.Any() == false)
{
//cannot be determined, then the base url has to be the first url registered
return string.Format("http://{0}", ApplicationContext.Current.OriginalRequestUrl);
//cannot be determined, then the base url has to be the first url registered. Use HTTP or HTTPS as appropriate.
if (GlobalSettings.UseSSL)
{
return string.Format("https://{0}", ApplicationContext.Current.OriginalRequestUrl);
}
else
{
return string.Format("http://{0}", ApplicationContext.Current.OriginalRequestUrl);
}
}
foreach (var server in servers)
@@ -58,8 +72,15 @@ namespace Umbraco.Core.Sync
}
}
//cannot be determined, then the base url has to be the first url registered
return string.Format("http://{0}", ApplicationContext.Current.OriginalRequestUrl);
//cannot be determined, then the base url has to be the first url registered. Use HTTP or HTTPS as appropriate.
if (GlobalSettings.UseSSL)
{
return string.Format("https://{0}", ApplicationContext.Current.OriginalRequestUrl);
}
else
{
return string.Format("http://{0}", ApplicationContext.Current.OriginalRequestUrl);
}
}
/// <summary>

View File

@@ -49,8 +49,16 @@ namespace Umbraco.Web
//see: http://issues.umbraco.org/issue/U4-2059
if (ApplicationContext.Current.OriginalRequestUrl.IsNullOrWhiteSpace())
{
// the keepalive service will use that url
ApplicationContext.Current.OriginalRequestUrl = string.Format("{0}:{1}{2}", httpContext.Request.ServerVariables["SERVER_NAME"], httpContext.Request.ServerVariables["SERVER_PORT"], IOHelper.ResolveUrl(SystemDirectories.Umbraco));
// the keepalive service will use that url. Check if 443 should be used for HTTPS.
if (GlobalSettings.UseSSL)
{
ApplicationContext.Current.OriginalRequestUrl = string.Format("{0}:{1}{2}", httpContext.Request.ServerVariables["SERVER_NAME"], 443, IOHelper.ResolveUrl(SystemDirectories.Umbraco));
}
else
{
ApplicationContext.Current.OriginalRequestUrl = string.Format("{0}:{1}{2}", httpContext.Request.ServerVariables["SERVER_NAME"], httpContext.Request.ServerVariables["SERVER_PORT"], IOHelper.ResolveUrl(SystemDirectories.Umbraco));
}
LogHelper.Info<UmbracoModule>("Setting OriginalRequestUrl: " + ApplicationContext.Current.OriginalRequestUrl);
}