Oh - we do use a 401, but with a Location header

This commit is contained in:
Dan Milne
2025-10-23 22:27:11 +11:00
parent 19cc425f94
commit e3e2a565e7

View File

@@ -133,8 +133,10 @@ module Api
session[:return_to_after_authenticating] = original_url session[:return_to_after_authenticating] = original_url
# Return 302 redirect to login page # Return 401 Unauthorized with Location header
redirect_to "#{base_url}/signin", allow_other_host: true # Caddy will automatically redirect to this URL
response.headers["Location"] = "#{base_url}/signin"
head :unauthorized
end end
def render_forbidden(reason = nil) def render_forbidden(reason = nil)