The server redirects the login URL to the AngularJs page containing the # sign (hash)

I am using Spring Security to work with session timeout. My application also uses AngularJs .

I have the following problem:

If the timeout session and the user issues a request without an ayax from the angularJs page to a secure URL, Spring Security redirects me to the login URL , but saves part of the URL after # (hash) .

Let me illustrate:

  • User is in / myapp / foo #! / Bar
  • Time session
  • User questions get a request for a secure URL
  • User is redirected to / myapp / signin #! / Bar

How can I avoid adding the #! / Bar part to the subscription page?

Change . There is a slight error in the above description. The problem use case is as follows:

  • The user is not logged in and is trying to access a protected resource, for example: localhost:8080/bignibou/curriculum/#/view/1(by pasting this URL into the address bar of the browser, for example).
  • They will be automatically redirected to the following URL: http://localhost:8080/bignibou/signin#/view/1

Pay attention to the part that contains after saving the symbol. Please note that this has more to do with AngularJs than Spring Security as Spring Security does not include a hash sign (this is confirmed by the fact that the hash never appears on the network tab of the chrome dev tools ...)

+3
source share
2 answers

Angular - HTTP/3xx, (, , IE9 ). :

URL

:

URI U3C - 4.1.

Edit:

(, , ) , HTML5. :

history.replaceState("", document.title, window.location.pathname + window.location.search)

replaceState Mozilla.

- , IE . google , IE10 , , :

window.location.hash = ""

, #, hey, it IE.

:

if("replaceState" in history)
  //  proper browsers
  history.replaceState("", document.title, window.location.pathname + window.location.search)
else
  // fallback for ie
  window.location.hash = ""
+4

Rob, , .

URL- `/login # ', URL- , .

+2

All Articles