Hi everyone,
I’m running into a specific issue where videos larger than 5MB fail to generate Onebox previews on my Discourse instance (standard Docker install), whereas the same video links work perfectly on other Discourse sites.
The Problem:
When I post a video link (e.g., a 5.1MB .webm file), the Onebox fails. I’ve isolated the issue to a failure in Range request negotiation.
Debugging results from the Rails console:
- Manual Ruby Test (Success): Using standard
Net::HTTPand manually setting theRange: bytes=0-10header, I successfully get a 206 Partial Content from the source server. - Discourse System Test (Failure): When Discourse attempts to fetch the same URL via
FinalDestination.new(url).get, it receives a 200 OK (Net::HTTPOK) instead of a 206. Consequently, it attempts to download the entire file, hits the 5MBMAX_REQUEST_SIZE_BYTESlimit, and the Onebox fails with a “size too big” error.
I have already tested the following configurations, but the issue persists:
- Set a browser-like string in
onebox_user_agent. - Added the source domain to
force_custom_user_agent_hosts. - Verified the server has no global proxy configured (
env | grep -i proxyis empty). - Tested the same URL on other Discourse instances, where it Oneboxes perfectly.
The Question:
Why would one Discourse instance fail to negotiate a Range request (206) while another instance, pointing to the exact same URL, succeeds on the same network?
Is there any specific internal configuration, security middleware, or FinalDestination logic that might be stripping the Range headers or causing the remote server to fallback to a full 200 response?
Any insights or pointers on where to look next would be greatly appreciated!