# Javascript Embedding Discourse Comments - User Agent

**URL:** https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377
**Category:** Support
**Created:** [September 12, 2019, 8:33am UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377 "2019-09-12T08:33:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jono\_Brain2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jono_brain2/32/106550_2.png) [@Jono\_Brain2](https://meta.discourse.org/u/Jono_Brain2)
#### Post date: [September 12, 2019, 8:33am UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377/1 "2019-09-12T08:33:19Z")

</div>

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:

> [@Onebox user agent](https://meta.discourse.org/t/onebox-user-agent/61498):
>
> It appears that when onebox fetches a url to grab opengraph data, it sends a user agent string of “Ruby”. Can this be updated to provide a more useful user agent that identifies the crawler properly?

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?

---

<div class="post-metadata">

### Author: ![Jono\_Brain2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jono_brain2/32/106550_2.png) [@Jono\_Brain2](https://meta.discourse.org/u/Jono_Brain2)
#### Post date: [September 12, 2019, 3:12pm UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377/2 "2019-09-12T15:12:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 13, 2019, 10:25am UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377/3 "2019-09-13T10:25:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [September 13, 2019, 10:37am UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377/4 "2019-09-13T10:37:38Z")

</div>

Onebox uses its own user agent. I think @Jono_Brain2 is describing the “topic embed” scraper which pulls in content [like this](https://meta.discourse.org/c/site-feedback/blog)

> <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

---

<div class="post-metadata">

### Author: ![Jono\_Brain2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jono_brain2/32/106550_2.png) [@Jono\_Brain2](https://meta.discourse.org/u/Jono_Brain2)
#### Post date: [September 13, 2019, 10:42am UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377/5 "2019-09-13T10:42:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 13, 2019, 10:42am UTC](https://meta.discourse.org/t/javascript-embedding-discourse-comments-user-agent/128377/6 "2019-10-13T10:42:39Z")

</div>

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