Javascript Embedding Discourse Comments - User Agent

Hi

We are looking at embedding comments to pages on our website using the Embed JS feature (which looks awesome).

We have just run into a little issue and its similar to this:

We use prerender to server side render pages for certain user agents e.g. Google. We have added detection for 'Onebox which works great. However we need something similar for when the Embed scrapes the page.

I have tried to find the user agent sent but I haven’t managed to find it. Can anyone tell me what it is?

1 Like

Took a guess and it looks like the User Agent is ‘Ruby’.

That is odd, I am pretty sure onebox sends its own user agent. I know that because WPEngine loves to block all unknown user agents and we have to sometimes ask for the oneboxer user agent to be specifically whitelisted to onebox WP sites they host. Cc @techAPJ

Onebox uses its own user agent. I think @Jono_Brain2 is describing the “topic embed” scraper which pulls in content like this

https://github.com/discourse/discourse/blob/d01c938e1a8b5f96e16043aa8ec2aeeaee1be910/app/models/topic_embed.rb#L123

It doesn’t specify a user agent, so it uses the default Ruby agent

3 Likes

Thats exactly it. Onebox has its own user agent, but the embeddable comments uses default Ruby user agent.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.