MO1.2.2 URL-based direct access to an openIMIS page

openIMIS modular frontend is the Javascript/React application that runs on the client computer. Therefore, the server won't know the full URL used within the frontend application (there is no folder or files matching those URLs). In order to still be able to use URL to access an openIMIS page, a URL rewriting rule is required.

Solution

The frontend is able to receive a GET parameter that will provide with the page to load first. This parameter is dyn and must contain a valid application PATH, encoded using the base64 method.

NGINX

In the nginx configure file, a rewrite rule is required under the “front” location:

1 2 3 4 if ($request_uri ~* /front/(?![Ss]tatic)([^/]+/[^\?]+)(?:\?(.*))? ){ set_encode_base64 $digest $1; rewrite ^/front/.*$ /front/?dyn=$digest; }

This rule will transform all URLs under the “front“ route that target a file in a subfolder different than “static“.