Server side data rendering not working properly

I have two layouts. Each layouts are supposed to display based on user authentication. So I used Server side data on appconnect of the layouts. At first, they are working properly no issues there. But if you visit that layout again by using the browser’s back button then it is not redirected.

Example: If a user is logged out from the home page then he/she is redirected to login layout. If the user clicks the back button of browser, then he goes back to home page which is displayed. But it should not be displayed because the user is not authenticated. Keep in mind that, when I visit the different layout I refresh the page.

How can I fix this ?

Community Page
Last updated: