[SEO Utils] GetScreenUrl action returns HTTP instead of HTTPS in some cases (bug fix)

Forge Component
(4)
Published on 28 Mar by Miguel Seabra Melo
4 votes
Published on 28 Mar by Miguel Seabra Melo

When using the GetScreenUrl actions we discovered an issue that it sometimes generates URLs that do not contain https preventing, for instance, pop-up pages to be shown in our secure app environment. 

The following line of code to generate the URL in the extension contains an small error:

ssURL = ((((IWebScreen)Page).isSecure == RuntimePlatformUtils.RequestIsSecure(request) && RuntimePlatformUtils.RequestIsSecure(request)) ? "http://" :
                (RuntimePlatformUtils.RequestIsSecure(request) ? "https://" : "https://")) +
                (EmailScreenUtils.SafeGetEmailHost(Page as IEmailScreen) ?? request.Headers["OS-Host"] ?? request.Url.Host) +
                request.Headers["OS-Host-Suffix"] +
                RuntimePlatformUtils.GetEspacePrettyNamePath(sseSpaceName, heContext);

This should be:

ssURL = ((((IWebScreen)Page).isSecure == RuntimePlatformUtils.RequestIsSecure(request) && RuntimePlatformUtils.RequestIsSecure(request)) ? "https://" :
                (RuntimePlatformUtils.RequestIsSecure(request) ? "https://" : "https://")) +
                (EmailScreenUtils.SafeGetEmailHost(Page as IEmailScreen) ?? request.Headers["OS-Host"] ?? request.Url.Host) +
                request.Headers["OS-Host-Suffix"] +
                RuntimePlatformUtils.GetEspacePrettyNamePath(sseSpaceName, heContext);

After implementing this fix our issues were resolved.

Maybe this fix can be implemented in a new release of this component?



Hi Peter,

Thanks for reaching out... it's been a while since I looked at this component so I'll need to read through and test it again.

What you did write sounds very plausible indeed, and my code looks decidedly suspicious... but I need to be careful before changing it :-)

Regards,


Miguel

Hi Peter,

Better late than ever... I've uploaded a new version with a simplified section of that code that should behave as discussed. Please let me know if it works for you.

Cheers,


Miguel