# Why instagram link onebox like this?

**URL:** https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047
**Category:** Bug
**Created:** [January 8, 2020, 11:42am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047 "2020-01-08T11:42:12Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [January 8, 2020, 11:42am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/1 "2020-01-08T11:42:12Z")

</div>

why does [this instagram link](https://www.instagram.com/p/B3jG277hve9/) onebox like this?

[https://www.instagram.com/p/B3jG277hve9/](https://www.instagram.com/p/B3jG277hve9/)

it also links to nowhere if I don’t use hyperlinked text (you can click on the one-boxed link above)!

the link:  
`https://www.instagram.com/p/B3jG277hve9/`

---

<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: [January 9, 2020, 6:34am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/3 "2020-01-09T06:34:35Z")

</div>

My guess is it is a private account?

---

<div class="post-metadata">

### Author: ![rishabh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rishabh/32/179446_2.png) [@rishabh](https://meta.discourse.org/u/rishabh)
#### Post date: [January 9, 2020, 7:00am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/4 "2020-01-09T07:00:55Z")

</div>

Nope, that’s not a private account. Here’s another example from a fully public post:

[https://www.instagram.com/p/B6gUJwDl-lQ/](https://www.instagram.com/p/B6gUJwDl-lQ/)

* * *

Wow, I posted `https://www.instagram.com/p/B6gUJwDl-lQ/` but the onebox redirects to this topic itself…

(edit my post to repro this in the composer)

---

<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: [January 9, 2020, 7:05am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/5 "2020-01-09T07:05:30Z")

</div>

What’s different about this photo versus others?

---

<div class="post-metadata">

### Author: ![Hector](https://avatars.discourse-cdn.com/v4/letter/h/43a26b/32.png) [@Hector](https://meta.discourse.org/u/Hector)
#### Post date: [January 10, 2020, 1:22pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/6 "2020-01-10T13:22:49Z")

</div>

It seems that some Instagram pages have a canonical link with a different url that requires login. The code in the onebox library prefers the canonical url.

> <https://github.com/discourse/onebox/blob/main/lib/onebox/helpers.rb#L25-L40>

For example, these are the canonical urls of the instagrams in this topic:

https://www.instagram.com/shaparakgroup.ir/p/B3jG277hve9/caption/backhand\_index\_pointing\_right-chp-shprkh-ok\_hand-black\_small\_square-khrt-wyzyt-hy-brsh-khs

https://www.instagram.com/dogsofinstagram/p/B6gUJwDl-lQ/caption/happy-holidays-writes-konaandcamper-misslolathegoldendoodle-camera\_with\_flash-by-sh

---

<div class="post-metadata">

### Author: ![WaitroseCarpark](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waitrosecarpark/32/198599_2.png) [@WaitroseCarpark](https://meta.discourse.org/u/WaitroseCarpark)
#### Post date: [January 13, 2020, 7:12am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/7 "2020-01-13T07:12:08Z")

</div>

I’m getting this issue as well. Upgrading my installation now to see if it fixes.

---

<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: [January 13, 2020, 9:15am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/8 "2020-01-13T09:15:15Z")

</div>

@techAPJ can you fix this please? Basically we have to ignore canonical metadata for Instagram now..

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [January 13, 2020, 3:01pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/10 "2020-01-13T15:01:07Z")

</div>

> [@codinghorror](#):
>
> ignore canonical metadata for Instagram

Done via:

[https://github.com/discourse/onebox/commit/0d88354b4b85c572a7f2431bd01d849392625b5c](https://github.com/discourse/onebox/commit/0d88354b4b85c572a7f2431bd01d849392625b5c)

Example link:

[https://www.instagram.com/p/B7Cz042qSxv/](https://www.instagram.com/p/B7Cz042qSxv/)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 14, 2020, 12:20am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/11 "2020-01-14T00:20:55Z")

</div>



---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [May 21, 2020, 6:06pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/12 "2020-05-21T18:06:55Z")

</div>



---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [May 21, 2020, 6:07pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/13 "2020-05-21T18:07:25Z")

</div>

Looks like we’ve regressed here, or Instagram changed something again. We’re back to just showing “Login • Instagram”. cc @techAPJ

---

<div class="post-metadata">

### Author: ![cvx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cvx/32/152146_2.png) [@cvx](https://meta.discourse.org/u/cvx)
#### Post date: [May 22, 2020, 12:35am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/15 "2020-05-22T00:35:52Z")

</div>

Weird, that image on Instagram doesn’t have any `og:` meta tags anymore. 😬 Couldn’t find any other that would have them missing…

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 22, 2020, 8:20am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/16 "2020-05-22T08:20:25Z")

</div>

The weird thing is Instagram onebox is working okay for me locally (on latest Discourse version). And I do see OpenGraph (`og`) tags in incognito mode.

Reproducing this issue locally will be tricky.. investigating more.

---

<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: [May 22, 2020, 11:18pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/17 "2020-05-22T23:18:32Z")

</div>

Is it specific to that one image? 🤔

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 22, 2020, 11:51pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/18 "2020-05-22T23:51:49Z")

</div>

No, I tried multiple images from multiple accounts and all were oneboxing fine locally.

Here’s an image from [an hour ago](https://www.instagram.com/p/CAgdFv7IhtH) on NatGeo oneboxing fine locally.

 ![Screen Shot 2020-05-23 at 05.38.58](https://global.discourse-cdn.com/meta/original/3X/5/3/531bea868c788c1f84ad48be20c2f5416feed96e.jpeg)

Might be geographical issue?

FWIW, Instagram oneboxing is failing on [discourse.codinghorror.com](http://discourse.codinghorror.com) as well, so this issue is not specific to meta.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 23, 2020, 4:16am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/19 "2020-05-23T04:16:11Z")

</div>

Maybe the user agent changes the response?

---

<div class="post-metadata">

### Author: ![znedw](https://avatars.discourse-cdn.com/v4/letter/z/b5e925/32.png) [@znedw](https://meta.discourse.org/u/znedw)
#### Post date: [May 26, 2020, 4:55am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/20 "2020-05-26T04:55:12Z")

</div>

[https://www.instagram.com/p/CAojxzfjO0y/](https://www.instagram.com/p/CAojxzfjO0y/)

this is broken on our forum as well

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 26, 2020, 5:11am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/21 "2020-05-26T05:11:17Z")

</div>

I don’t think so. We use same user agent for all the requests made from Discourse codebase as per:

> <https://github.com/discourse/discourse/blob/edbc3565933819a9ebe4e80d567c35f5dca061a2/lib/final_destination.rb#L70>

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [May 26, 2020, 10:28am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/22 "2020-05-26T10:28:07Z")

</div>

> [@techAPJ](#):
>
> Might be geographical issue?

> [@znedw](#):
>
> this is broken on our forum as well

Same issue on ours now here in the UK too.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 26, 2020, 10:34am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/23 "2020-05-26T10:34:20Z")

</div>

I am updating Instagram onebox to use [official oEmbed](https://developers.facebook.com/docs/instagram/embedding/) endpoints. I have this change working locally and expect to push a fix later today. Hopefully the Instagram oEmbed endpoints will not have geographical restrictions.

[Next page](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047.md?page=2)
