Page tree
Skip to end of metadata
Go to start of metadata

Purpose

The Problem

There have been customers facing cyclic redirection of Virtual URI mappings such as HELPDESK-880 in which an infinite loop of redirects happen. A large amount of logs printed out. Most of CPU was allocated to these infinite loops. This cause running Magnolia instance crashes. Also we're lacking of tools to support this kind of human error.

Goals

Detect any new registering of Virtual URI mapping that might causing an infinite loop.

Limitation

Because Virtual URI mapping could be configured by Regular expressions, we can't assert all input URLs, this proposed algorithm is not a 100% accuracy solution. Any improvement or alternative strategies are welcome.

Use Cases

> AKA: User Stories
> List concrete ways in which this feature will be used.

  1. Customer create and register a new Virtual URI mapping.
  2. System check for the cyclic referencing if any from the newly created one.
  3. If there was no issue, a new entry added to VirtualUriRegistry. Otherwise a new problem reported both to log and in Definitions app as a major problem.

Proposal

Concept

> AKA: Design
> What is the overall approach to solve the problem. First summarize  the high level overview in a few lines.

What we are having

Currently we are having a VirtualUriRegistry which could be imagine as list of mappings. Each mapping has only fromUri and toUri are the 2 major properties. A function "mapUri" from the VirtualUriMapping using an input uri and produce an output of toUri with its matching score.

How can we do the cyclic detection

Once a new mapping created and registered, we will do following checking:

  • For whatever input that matched its fromUri, a unique toUri is produced. System will redirect / forward user to the new location.
  • Cyclic redirection happen when the new location or the next nth new location reference back to its precedent one.
  • Note that the backward referencing not necessary to be the original one, it could be any one along the redirection line. However if we supposed that we implemented this algorithm, then there were no cyclic referencing within our existing virtual URI mapping entries. The backward referencing could only go back to current one (the 1st checking URI which is the "toURI" of current config).

The algorithm

  1. Starting from new configured toUri and having a Set of traversed virtual URI mapping entries (non-loop-set).
  2. While still able to find the next mapped URI:
    1. Check if the next mapped URI exists in the non-loop-set. If yes then it's a cyclic one. Stop the finding here and reject the registration. 
    2. Add the toUri to the set.
    3. Use the next mapped URI as the toUri
    4. Continue finding
    5. Stop finding if we can't find any new matched. Allow the newly created virtual URI mapping to be registered.

Discussion, Suggestions, Q&A

Feel free to comment or edit the page for any improvement.

Etcetera

> Possible Improvements

> Discarded Proposals

> Discussion

> References

  • No labels