/
Cleanup redirect code [5.3.0-B1]

Cleanup redirect code [5.3.0-B1]

Redirect is a way for In-Portal to show user the content, that otherwise might be lost if user accesses the wrong page url. Here are redirects, that are currently made:

When RedirectedRedirect Place (in code)Why RedirectedTo Where Redirected
maintenance mode is enabledkApplication::RunAccessing any, but "Maintenance Mode" page"Maintenance Mode" page
kRedirectException exception is thrownkRedirectException::runSomebody threw the kRedirectException exceptionWherever kRedirectException wants
after event is finished executingRequestManager::performRedirectTo avoid double form submit problem on F5 pressSame page
  • the "ForceModRewriteUrlEnding" setting is enabled
  • opened url is missing ".html" (configurable)
kRewriteUrlProcessor::_redirectToDefaultUrlEndingTo ensure page url in browser always have ".html"Same page, but with ".html" appended
  • mod-rewrite is enabled
  • non mod-rewrite url (e.g. having "index.php" in it) is accessed
kHTTPQuery::AfterInitTo ensure all pages on website have mod-rewrite urlsMod-rewrite url equivalent of visited page
IP address of the visitor matches IP range from Site DomainSiteDomainEventHandler::querySiteDomainBecause Site Domain IP redirect feature was enabled
  • Matched site domain sub-domain
  • External/Internal url
  • the "UseContentLanguageNegotiation" setting is enabled
  • visitor browser language doesn't match website default language
LanguagesItem::Load (via kRedirectException)To show website content on user preferred language automaticallySame page, but on different language

It's clearly seen based on above table, that there is no single solution/place for doing redirects and they can happen any time without developer even knowing/willing.

Solution

  1. create extension point in "kApplication::Run" method (where we know, that user wants to see the page)
  2. move "redirect or not redirect" decision making to that extension point

This way:

  • there will be a central place to find all possible redirects 
  • if we're not showing any content back to user, then we even don't bother checking if a redirect should be happening
  • instead of doing several redirects in a row (to match a Site Domain and user language) we can combine them into one

Related Tasks