A less-practical example would require editing an existing AJAX request.
Consider the edit service page in the admin UI. This page makes an AJAX request to display the totals in a box.
If the GET parameters for this request do not include both a valid client and service ID, or the service does not match the client, a 401 response is encountered.
Currently, a 401 response will cause the edit-service page to refresh continuously because it will continuously make the same invalid AJAX request.
If a 401 response did not perform a redirect, the UI would not be updated to include the totals box.
On a side note, the JS also performs an identical redirect for status code 406.
A less-practical example would require editing an existing AJAX request.
Consider the edit service page in the admin UI. This page makes an AJAX request to display the totals in a box.
If the GET parameters for this request do not include both a valid client and service ID, or the service does not match the client, a 401 response is encountered.
Currently, a 401 response will cause the edit-service page to refresh continuously because it will continuously make the same invalid AJAX request.
If a 401 response did not perform a redirect, the UI would not be updated to include the totals box.
On a side note, the JS also performs an identical redirect for status code 406.