Your Location is: Home > Authentication

SSO not redirecting correctly when # (hashtags) in the URL

From: Bangkok View: 3200 user2140631 


For the very first time, when the user is NOT logged in (via CAS SSO), it's redirecting incorrectly after login. It is repeating everything after # tag. Example: /appname/#/service/7120 is being redirected to /appname/#/service/7120#/service/7120.

However, if already logged in, it works correctly.

Best answer

The fragment after # tag stays in browser, and never reaches to server. In other words, the request URI seen by server does not include the fragment. So after login, you can not simply restore to original request to include the fragment in server. Typically, you will need store the original request (including fragment) in client side (browser) by using javascript (say create a cookie) before you redirect user to login page, then restore request to the original request URI (say from cookie) after login.