In the history server when we open an application link for the first time, it loads the app and registers the app UI and sends a redirect to the URI that was requested.
The code to send the redirect is:
However req.getRequestURI() is not the complete URI that was requested, it doesn't contain the query string.
Stage URIs are of the following form:
When such a URI is the first URI from the application to be requested, it redirects to a URI like:
which errors with
This is not a frequent occurrence because you usually navigate to the stage URI after you have navigated to some other URI belonging to the application and then this will not happen, only when the stage URI is the first URI from the application to be requested from the history server will you see this issue.