# This is using nginx's built-in variables, should be copy-paste for most setups.
error_page 401 $scheme://$server_name/api/v2/organizr/error/$status?return=$request_uri; # We only want the Unauthorized code to redirect back to the loginpage
error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$server_name/api/v2/organizr/error/$status; # Responds with the errorpage for the errorcodes listed