Null reference exception happened when the page is redirected in SSLOffload environment

Description

When a page is setup to redirect to the existing page in SSLOffload environment, null reference exception occurs when the page is typed in from the browser
In this scenario Page2 is setup to redirect to Page3. Please check the attached file for details on configuration.

To reproduce,
1. Setup SSL Settings
2. Setup Page2 to redirect to Page3
3. Request Page2 from a browser (e.g https://dnndev.me/Home/Page2)

After investigation, the exception is from the function
IsSecureConnectionOrSslOffload(HttpRequest request) where the PortalSettings is null and it was used to get the ActiveTab information.

In our opinion for this scenario, checking the IsSecure of the Active Tab is not related to determining whethere a request is secure or not.

Our suggestion on fixing is as following.

public static bool IsSecureConnectionOrSslOffload(HttpRequest request)
{
if (request.IsSecureConnection)
{
return true;
}
string ssloffloadheader = HostController.Instance.GetString("SSLOffloadHeader", "");
//if the ssloffloadheader variable has been set check to see if a request header with that type exists
if (!string.IsNullOrEmpty(ssloffloadheader))
{
string ssloffload = request.Headers[ssloffloadheader];
if (!string.IsNullOrEmpty(ssloffload))
{
return true;
}
}
return false;
}

QA Test Plan

None

Assignee

Unassigned

Reporter

Mantra IT

Story Size

None

Severity

Major

Triage

New

Reported in Build #

None

Fixed in Build

None

Dev Owner

None

Includes Code Fix

Yes

Documentation Required

None

Trouble Ticket

None

Requires More Info

None

QA Story Points

None

QA Owner

None

Injected

Injected

Automation Required

None

Code Review Owner

None

Components

Affects versions

Priority

High
Configure