• J
    Improve logging when Origin header doesn't match · a500b479
    Jon Leighton 提交于
    I came up against this while dealing with a misconfigured server. The
    browser was setting the Origin header to "https://example.com", but the
    Rails app returned "http://example.com" from request.base_url (because
    it was failing to detect that HTTPS was used).
    
    This caused verify_authenticity_token to fail, but the message in the
    log was "Can't verify CSRF token", which is confusing because the
    failure had nothing to do with the CSRF token sent in the request. This
    made it very hard to identify the issue, so hopefully this will make it
    more obvious for the next person.
    a500b479
request_forgery_protection.rb 16.5 KB