Inline-onebox gebruikt SiteSetting.onebox_user_agent niet

Hello,

we have recently deployed Anubis on our server to protect against resource-intense AI crawlers. It sends a static page with title “Making sure you’re not a bot!” to requests sent with browser-like user agents, does a javascript proof-of-work and then redirects to the proper page. User agents that don’t have Mozilla in the name can directly access the page.

Now the discourse onebox link previews are broken, but only for inline links.

Looking at server logs, discourse sends two different types of user agents:

  • Discourse Forum Onebox v3.4.1 for big onebox link previews (see lib/onebox/helpers.rb#L217-L226 in 03f3e84ce520d375aa1c66bb0e95cc5ed9832776)

  • Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15 for inline link previews (seelib/final_destination.rb#L40 in 03f3e84ce520d375aa1c66bb0e95cc5ed9832776)

I’ve tried “Force custom user agent hosts” in the admin settings, which claims “Hosts for which to use the custom onebox user agent on all requests.”, but it didn’t make a difference.

I’ve also tested changing the onebox_user_agent hidden setting, but it only changes the regular onebox link preview user agent, not the inline one.

This looks like a bug to me, wouldn’t it make more sense to use the same configurable Discourse Forum Onebox user agent for inline link previews too?

Thanks!

1 like

Ik krijg ook twee verschillende oneboxen, één HEAD-verzoek met een browser-user-agent en één GET-verzoek met een identificeerbare user-agent. Als het HEAD-verzoek wordt omgeleid (naar een uitdagingspagina), volgen er drie verzoeken, allemaal naar de omgeleide pagina.

Ik moet alle HEAD-verzoeken op de witte lijst zetten in ons uitdagingssysteem zodat onebox werkt. Niet alleen inline-onebox, maar ook block onebox.

Dit voelt meer als een functieaanvraag dan een bug. Inline onebox en onebox zijn verschillende functies die het netwerk op verschillende manieren gebruiken. Misschien hebben we hier een andere site-instelling voor nodig.

Het is oké om in ieder geval nog een verborgen instelling toe te voegen voor inline oneboxes, zodat je verder kunt.