Issue with Onebox not working for videos larger than 5MB

I noticed that when using Discourse, video links larger than 5MB fail to generate a Onebox.
Looking at the logs, the error occurs at:

/var/www/discourse/lib/final_destination.rb:249:in `block in resolve'

I checked final_destination.rb and found the following code:

MAX_REQUEST_SIZE_BYTES = 5_242_880 # 1024 * 1024 * 5
request_start_time = Time.now
response_body = +""
request_validator =
  lambda do |chunk, _remaining_bytes, _total_bytes|
    response_body << chunk
    if response_body.bytesize > MAX_REQUEST_SIZE_BYTES
      raise Excon::Errors::ExpectationFailed.new("response size too big: #{@uri}")
    end
    if Time.now - request_start_time > MAX_REQUEST_TIME_SECONDS
      raise Excon::Errors::ExpectationFailed.new("connect timeout reached: #{@uri}")
    end
  end

However, on other Discourse sites—both the official forum and another Discourse site I manage—Onebox works fine for videos larger than 5MB.
I can confirm that on my other Discourse site, MAX_REQUEST_SIZE_BYTES has not been modified in any way.
Could someone explain why this is happening, and how I can fix it?