"The default settings of the ui-router in AngularJS produces URLs like http://localhost/#/products/details/12345. Your Servlet gets a request for / and after a successful SAML authentication you are sent back to http://localhost/. The location hash #/products/details/12345 is lost during the authentication."
This is ok if you have a landing page, but not after session timeout.
"The solution was to enable the hmtl5mode in the $locationProvider and add a base tag to the HTML. When this feature is enabled, the URLs look like http://localhost/products/details/12345."
Also good links: