Embedding error

So after the latest Discourse update all embedded pages now report an error :sweat_smile:

A typical error message we see now goes something like this, which seems to indicate that the browser is doing some referer stripping and causing the Discourse embed code to fail its validation checks:

Referer: `https://www.comses.net/`

The referer was either not sent, or did not match any of the following hosts:

* www.comses.net/codebases/.* 

Example page: Artificial Anasazi

On Chrome, even with Privacy Badger / all other extensions disabled, the referer error message always seems to appear and is probably due to A new default Referrer-Policy for Chrome - strict-origin-when-cross-origin  |  Blog  |  Chrome for Developers UPDATE this now works for existing topics after adding an explicit Referrer-Policy to the originating site (e.g., https://www.comses.net) so for haproxy something like: http-response set-header Referrer-Policy "no-referrer-when-downgrade"

On Firefox and Chrome, pages with existing topics work but pages that attempt to create a new topic fail like this one: The Bronze Age Collapse model (BACO model).

I’ve changed our haproxy config to set response headers for Content-Security-Policy frame-ancestors and that fixed an invalid X-Frame-Options ALLOWALL not recognized error in Firefox but now the request times out and eventually results in a 400 Bad Request from our Discourse forum..

The error appears to be related to postMessage:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://forum.comses.net') does not match the recipient window's origin ('https://www.comses.net').

I’ll have more time to do a deeper dive towards the end of this month when I will have some more free time but wanted to brain dump while it’s still semi-fresh - hope someone else figures out a workaround in the meantime! :grin: