How to manage logged in status when the user clicks back button?

Something I have had trouble understanding the technical/implementation requirements is what should happen to a user's logged in state when they press the back button immediately after logging in (or actions that put them in a logged in state).

To align with user expectations, there should be a clear call-to-action followed by some status indicator that they are logged in. Hence one might also expect there to be a clearly defined interaction if the user ends up being in a logged out state.

However, the back button behaviour on a browser for a web application doesn't always seem to obey this rule, and I am looking for some good examples of how this is best managed from a consistent and fluent user experience point of view.

It will be helpful if any technical limitations that result in a less than ideal user experience can be explained.