A user reports that Onebox previews are not working for their site, despite having valid OpenGraph tags and serving pages to the Discourse robot. taylorswift initially suspected a HEAD request issue, but after adjusting the server to return 200 OK for HEAD, the problem persisted. Arkshine suggests checking if the server blocks requests, noting a 400 error in the fetch response. taylorswift reveals their server requires both a specific User-Agent and Accept-Language: * header, which the Discourse bot doesn’t send. Arkshine confirms it’s a GET request with only the User-Agent header. taylorswift identifies the missing Accept-Language header as the cause and resolves the issue.
i have a site to which i added the required <meta> OpenGraph tags to, but is not displaying any Onebox previews. it is passing OpenGraph validation, so i doubt it is a markup issue.
(i cannot post a link to the validator, because i am a new user)
i can observe on the server end that it is indeed serving pages to the Discourse robot:
User-Agent: 'Discourse Forum Onebox v3.3.0.beta1-dev'
IP Address: 2602:fd3f:3:204:0:242:ac11:2d
but the links just do not show up:
i considered that the problem could be because we return 505 HTTP Version Not Supported for HEAD requests, based on this thread. so i patched our server to return a perfunctory 200 OK response for the HEAD method:
i see, i have reconfigured the site to treat HEAD requests identically to GET requests.
the site has a security policy that will return 400 unless the client sends a user agent string that starts with the string "Discourse Forum Onebox" and an Accept-Language: * header. i am able to pass the filter using curl with the following settings:
$ curl -v -I --http1.1 \
-A 'Discourse Forum Onebox v3.3.0.beta1-dev' \
-H 'Accept-Language: *' \
https://swiftinit.org -o /dev/null