Rails error: No HTTP_REFERER was set in the request to this action

Viewed 2506

I am developing a new rails app. but found a error:

ActionController::RedirectBackError in UsersController#show

No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].

my code:

rescue_from CanCan::AccessDenied do |exception|
     redirect_to :back
end

I have some question for this error:

  • what is HTTP_REFERER?
  • why redirect to back will trigger this error?

Anyone has good idea?

1 Answers
Related