Stop redirecting on unauthorized errors
✦ 2023-02-09
Here’s a scenario:
- A colleague on Slack sends you a link to some page they want you to check out. Maybe something like http://example.com/some-resource.html.
- You click the link.
- The backend decides that you don’t have access to view
some-resource.html
. - It returns a redirect to http://example.com/unauthorized.html.
- You read the error message that tells you that you don’t have access to view that page.
- You return to Slack and ask your colleague to grant you access.
- They apologise and say that they’ve fixed it.
- You return to your browser and refresh.
- Still an unauthorized error.
- You wonder if there’s some eventual consistency in the system, maybe your colleague granted you access to the wrong page, or maybe they granted access to the wrong person.
- You then realise that you’re still at
unauthorized.html
(not the page you actually want) so you go back to Slack and click the link again.
Why do this?