I am overriding Devise\'s failure response so that I can set a 401 status code. However, when the user fails to sign in, they are redirected to a page with a \"you are being
As said by @pantulis the browser will display this standard message if the response code is not a 3xx
To workaround this you can perform a javascript redirect:
# example with status 500:
render text: "", status: 500
This is off-course valid only if you are sure that all your users are using javascript. If your application can be browsed by users that may have disabled javascript you should also include a noscript tag and fallback in the standard "You are being redirected" message