Redirect logged in users on application restart

0
Hello,   Is it possible to enforce a redirection to another page (outside the application) for logged-in users when the application is restarted during the deployment process?   Thank you.
asked
3 answers
0

Hi Almog,

 

I have not tested it, but you could try to use the Mendix pusher service (see here). There you could call a nanoflow with a Javascript action and the following content:

window.open("https://www.youraddress.com","_self")

(see here).

 

Please let me know if that helps!

 

Best,

Holger

 

answered
0

Testing if they are still logged in would require access to the Mendix runtime/database (since the session would be in the database). Which isn't avalaible during restarts.

However you can use the custom error page "offline.html" to redirect to a specific url.

See https://docs.mendix.com/howto/front-end/custom-error-page/ 

You can let it execute a small javascript function to check if a Mendix session cookie exists and then redirect based on that function, but it isn't secure (as in the check shouldn't be trustworthy for sensitive data).

Edit: if you mean you want to alert logged in users to save their work and go somewhere else before the restart happens: in that case you could do something like a notification that the administrator will trigger before restarting and that is shared with all logged in users through Pusher (so you don't have to poll the database)

answered
0

I'm trying to cover a case where the user is logged in while deployment starts.

If the user attempts to perform an action he gets a pop-up saying "Something went wrong" which is expected but I want to avoid that.

 

Before the deployment, I notify the users using a toast notification and a banner, but I want to cover more cases.

answered