Redirect to login page after session timeout

Implement an AngularJS httpInterceptor that redirects to login page when a 440 response code is received. In the server side, implement an authentication entry point that return a 440 code when session is expired and request is made using AJAX.