• D
    Add `redirect_back` for safer referrer redirects · 13fd5586
    Derek Prior 提交于
    `redirect_to :back` is a somewhat common pattern in Rails apps, but it
    is not completely safe. There are a number of circumstances where HTTP
    referrer information is not available on the request. This happens often
    with bot traffic and occasionally to user traffic depending on browser
    security settings.
    
    When there is no referrer available on the request, `redirect_to :back`
    will raise `ActionController::RedirectBackError`, usually resulting in
    an application error.
    
    `redirect_back` takes a required `fallback_location` keyword argument
    that specifies the redirect when the referrer information is not
    available.  This prevents 500 errors caused by
    `ActionController::RedirectBackError`.
    13fd5586
redirecting.rb 6.5 KB