# Embedding integration failure when browser strips referrer, bad fallback

**URL:** https://meta.discourse.org/t/embedding-integration-failure-when-browser-strips-referrer-bad-fallback/104866
**Category:** Feature
**Created:** [December 21, 2018, 9:25pm UTC](https://meta.discourse.org/t/embedding-integration-failure-when-browser-strips-referrer-bad-fallback/104866 "2018-12-21T21:25:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [December 21, 2018, 9:25pm UTC](https://meta.discourse.org/t/embedding-integration-failure-when-browser-strips-referrer-bad-fallback/104866/1 "2018-12-21T21:25:18Z")

</div>

via the html/js embed code in customize \> embedding, like this:

```plaintext
Allowed hosts: blog.example.com
Class name: blog
Path whitelist: /.*

Username for topic creation: system
Maximum number of posts to embed: 0
Truncate the embedded posts: checked

```

and

`DiscourseEmbed = { discourseUrl: 'https://forum.example.com/', discourseEmbedUrl: '{{@blog.url}}{{url}}' };`

Expected result: display a link to the corresponding Discourse topic for the blog post. The link shows the number of comments in the forum topic.

We’ve seen in various cases:

> Error Embedding  
> Referer:  
> The referer did not match any of the following hosts:  
> `blog.example.com`

We tracked down the error to happen on browsers stripping/spoofing the referrer header. Apparently the Discourse-supplied embed.js uses the browser referrer string to match the allowed host.

Most browsers will send referrer by default. The only exception we found is older versions (iOS 11) of Firefox/Firefox Focus. But some privacy-oriented plugins like Privacy Badger or others may strip the referrer.

The ideal solution might make this function (at least somewhat) without the referrer, but at least a friendlier and more informative error message could be along the lines of “your browser has disabled sending of referrers”. At least people should not think something else is broken with the feature…

---

<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: [December 22, 2018, 12:51am UTC](https://meta.discourse.org/t/embedding-integration-failure-when-browser-strips-referrer-bad-fallback/104866/2 "2018-12-22T00:51:32Z")

</div>

I mean, I guess, but the only “improvement” would be

> The referer was either not sent, or did not match any of the following hosts:  
> `blog.example.com`

Which seems like an _exceedingly_ minor nitpick.

---

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [December 22, 2018, 1:04am UTC](https://meta.discourse.org/t/embedding-integration-failure-when-browser-strips-referrer-bad-fallback/104866/3 "2018-12-22T01:04:07Z")

</div>

Yeah, if there’s no other workaround to the underlying issue.

It would be nice for others who experience the same thing to avoid too long troubleshooting since we’ve identified that common privacy plugins may have this effect. So, whatever makes the issue clear seems nice at least…

---

<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: [December 22, 2018, 1:28am UTC](https://meta.discourse.org/t/embedding-integration-failure-when-browser-strips-referrer-bad-fallback/104866/4 "2018-12-22T01:28:29Z")

</div>

Well, the copyedit is easy enough, and could be helpful, so I’ve done that at least.
