SkyLin reports a 403 error when using the Onebox preview function for Udemy URLs, which previously worked fine. The issue began after a Discourse update, though the Onebox plugin version remained unchanged. Testing revealed that YouTube previews still work, and Udemy URLs generate previews successfully via Facebook’s debug tool, suggesting the problem is specific to Discourse’s Onebox handling. SkyLin compared Docker and Discourse repository updates before and after the error emerged, noting no relevant plugin changes. Further troubleshooting included restoring a pre-update VPS backup (which resulted in a 502 error), cloning the VPS to a new instance (which reproduced the 403 error), and analyzing HTTP headers via cURL. The headers show Udemy returning a 403 with Cloudflare protections, while Amazon URLs return 503, hinting at possible bot detection or rate-limiting. A similar historical issue involving Amazon Onebox was referenced here. The root cause remains unresolved, with suspicion falling on Discourse’s outbound request handling or Cloudflare’s response to Discourse’s server IP/user-agent.
I did some further testing, none of them solve this bug.
Testing 1. Restore the backup* which before the bug occur. Reboot system then got a 502 error
PS: VPS disk image backup on 4/27, not discourse backup zip file
The new backup file can restore and reboot without problem, only old backup failed. It’s wierd. Theoretically the old backup should work fine as the other backup.
Testing 2. Clone the VPS disk image backup to a new VPS, followed the steps below to setup a new domain. The new site works fine, but this bug still exist. It should be due to rebuilt will load new discourse image which is the same.
Testing 3. Follow the steps of web page below to see why 403.
The image here show the difference of onebox between meta(above) and my site(below).