Hello guys,
Our hosting provider handles the HTTPS requests by a proxy and sends it as HTTP to the webserver.
(It seems a standard configuration; Amazon AWS and EC2 do the same.)
The result is that DW uses a <base href"http://"> because it does not recognize that the client-browser requests HTTPS.
MS-IIS has only bindings on port 80.
This causes problems with the internal links on the page because they refer to HTTP instead of HTTPS. And the user gets warnings when surfing to the page.
- How can we force DW to use the correct <base href>
Or
- How can we change manual the <base href> ?
Thanks for your tips.
Jurgen
Developer forum
E-mail notifications
HTTPS and proxy
Jurgen van Kreij
Posted on 25/05/2012 16:22:14
Replies
Nicolai Høeg Pedersen
Posted on 29/05/2012 10:53:18
This post has been marked as an answer
Hi Jurgen
You can make a notficiation subscriber and overrule the base href Dynamicweb adds. Below a subscriber that does exactly the same as DW does internally - change it so it returns https in the wanted situations.
You can make a notficiation subscriber and overrule the base href Dynamicweb adds. Below a subscriber that does exactly the same as DW does internally - change it so it returns https in the wanted situations.
using System.Web; namespace Dynamicweb.Examples.CSharp.Notifications.Standard { [Extensibility.Subscribe(Dynamicweb.Notifications.Standard.Page.Loaded)] public class PageLoadedObserver : Dynamicweb.Extensibility.NotificationSubscriber { public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args) { if (args == null) return; Dynamicweb.Notifications.Standard.Page.LoadedArgs loadedArgs = (Dynamicweb.Notifications.Standard.Page.LoadedArgs)args; if (Dynamicweb.Frontend.SearchEngineFriendlyURLs.RedirectType != Dynamicweb.Frontend.SearchEngineFriendlyURLs.Type.None) { string host = HttpContext.Current.Request.Url.Host; int port = HttpContext.Current.Request.Url.Port; string url = null; if (string.Compare(HttpContext.Current.Request.Url.Scheme, "https", true) == 0) { url = string.Format("https://{0}/", host); } else { if (port == 80 || Base.GetGs("/Globalsettings/System/http/DisableBaseHrefPort") == "True") { url = string.Format("http://{0}/", host); } else { url = string.Format("http://{0}:{1}/", host, port); } } loadedArgs.pageview.Meta.Add("basehref", url); } } } }
Votes for this answer: 0
Jurgen van Kreij
Posted on 29/05/2012 12:38:17
Hello Nicolai,
Thank you for your quick reply.
This should solve the issue.
Kind regards,
Jurgen
Thank you for your quick reply.
This should solve the issue.
Kind regards,
Jurgen
You must be logged in to post in the forum