Basic-Auth and Redirects

I’m using Basic-Auth to password-protect some of the content on a website. Auth and login work as expected, but when I click ‘Cancel’ on the auth dialog, I’m taken to a broken page with that says HTTP ERROR 401.

For ‘Cancel’, I’d like to simply close the dialog, or at least redirect back to the index page. I’ve tried to declare a redirect for the 401 error using the netlify.toml file, but haven’t been successful. What am I doing wrong?

Welcome to our community site, @interactivematt.

There isn’t a way to make a custom 401 page at this time. We do have an open feature request for this and I have added this community topic to that feature request.

If/when making a custom 401 page becomes possible with Netlify, we’ll follow-up here to let you (and anyone visiting this page) know about the new feature.

If there are other questions about this, we’re happy to answer.