# Onebox (deprecated) gem question on allowed domains & settings

**URL:** https://meta.discourse.org/t/onebox-deprecated-gem-question-on-allowed-domains-settings/310589
**Category:** Development
**Created:** [June 5, 2024, 3:10am UTC](https://meta.discourse.org/t/onebox-deprecated-gem-question-on-allowed-domains-settings/310589 "2024-06-05T03:10:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 5, 2024, 3:10am UTC](https://meta.discourse.org/t/onebox-deprecated-gem-question-on-allowed-domains-settings/310589/1 "2024-06-05T03:10:24Z")

</div>

I was playing with the old onebox gem here [discourse/onebox: (DEPRECATED) A gem for turning URLs into website previews (github.com)](https://github.com/discourse/onebox) (I see it is deprecated, just trying to understand it a bit more) and couldn’t see how to set up options for it. I think there is a cache: value to set but didn’t see anything else.

When I use it with this

```ruby
url = 'https://meta.discourse.org/t/upgrading-v2-2-0-beta4-
forum-with-unknown-local-changes/310241'
Onebox.preview(url).to_s

```

..it works fine, gives a onebox. When I use it with an og site like this:

```ruby
url = 'https://bonnieplants.com/blogs/garden-fundamentals/v
egetable-garden-care-tips'
Onebox.preview(url).to_s

```

..it doesn’t, e.g. returns empty.

The same links in Discourse onebox ok of course. I suspect there is some sort of AllowedDomainsList regex (?) that opens it up via config and was wondering how I could use that with this gem? Can I pass that option somehow, or use it as an engine some how? I am hunting around the specs but think I am missing it.

Appreciate any insights, even if this is a deprecated gem. Thanks! ❤

---

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 5, 2024, 9:49pm UTC](https://meta.discourse.org/t/onebox-deprecated-gem-question-on-allowed-domains-settings/310589/2 "2024-06-05T21:49:22Z")

</div>

I was being lazy, but stepping through the code the old onebox can allow this with using the allowed\_domains on the generic onebox e.g.

```ruby
Onebox::Engine::AllowlistedGenericOnebox.allowed_domains << hostname
preview = Onebox.preview(url, onebox_options).to_s

```

---

<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: [July 5, 2024, 9:49pm UTC](https://meta.discourse.org/t/onebox-deprecated-gem-question-on-allowed-domains-settings/310589/3 "2024-07-05T21:49:53Z")

</div>

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