Configure Instance on a different domain
How to configure a single Remark42 instance for multiple domains
What doesn't work so far?
Firefox with "block all third-party cookies" turned on: it keeps no cookie for an embedded widget, partitioned or not, whatever the configuration. OAuth sign-in fails there at once, and Email, Telegram and anonymous sign-in last only until the next page load. In every other browser and mode measured below, sign-in by any method on a page under another registrable domain works over https with no cookie setting, as the setup below explains.
Discussion #1139 has the history of cross-domain OAuth.
Setup
Serve Remark42 over https, with an https:// REMARK_URL, and set ALLOWED_HOSTS="'self',https://example1.org,https://example2.org" with your domain names. Leave AUTH_SEND_JWT_HEADER off unless a client of yours needs the token in a response header, and AUTH_SAME_SITE at its default unless you enable Apple sign-in, which needs none; the reasons follow.
A widget embedded on another site keeps its session in a pair of cookies of its own, __Host-JWT-EMBEDDED (HttpOnly) and __Host-XSRF-TOKEN-EMBEDDED, which the server sets with SameSite=None; Secure; Partitioned, so the browser keeps them for the embedding site even where it blocks third-party cookies. Email, Telegram and anonymous sign-in happen inside the widget, and the server answers them with Remark42's own pair and this one, so the browser keeps whichever it may. OAuth completes in a popup, which is a top-level page of Remark42's own site, so the session it sets belongs to that site; the popup then hands the sign-in over to the widget: it tells the widget which sign-in is under way before it goes to the provider, the provider's callback records which account signed in, and the widget receives the pair above.
Where the browser lets the widget see Remark42's own session for the same account, on a page of the same site or in a browser that still sends third-party cookies to it, the widget uses that session instead, and the server expires the widget's own pair. A renewal of the token in a widget on its own pair writes only that pair, so a reader who signed out on Remark42's own page or on another site is not signed back in there. Signing out in the widget ends both sessions it can reach. All of this needs https, since a partitioned cookie has to be Secure; over plain http the sign-in window goes straight to the provider, as it did before, and the widget has no session of its own.
AUTH_SEND_JWT_HEADER adds the token to a response header for clients that need it, and none of the above depends on it. No response served from the widget's own pair carries that header; the sign-in that first sets the pair beside Remark42's own may. Read its security considerations if a client of yours needs it.
AUTH_SAME_SITE=none lets Remark42's own cookies be sent to a widget on another site in a browser that still accepts third-party cookies, so the widget shares Remark42's session there: signing in as somebody else on one signs the other in as them too, and signing out of one signs out of both. Only Apple sign-in needs it, as below. strict breaks OAuth sign-in: the provider sends the reader back to Remark42's callback from its own site, a browser does not send a strict cookie with that cross-site request, and the sign-in fails. Apple returns the reader with a cross-site POST, which carries no lax cookie either, so with Apple sign-in enabled set AUTH_SAME_SITE=none.
The 'self' in ALLOWED_HOSTS value means "domain where Remark42 is installed on" and needed if you want remark42.example.com/web/ to work in case you want to test something with it.
Technical details
ALLOWED_HOSTS has three uses. It sets CSP frame-ancestors, which limits the hosts allowed to embed Remark42; when it is empty, any host can. Its plain host entries, with the host of REMARK_URL, also limit the address a sign-in returns the reader to; 'self' and entries with * do not count there. Page titles are fetched only from addresses on the listed domains and their subdomains, and on the domain formed by the last two labels of the REMARK_URL host name and its subdomains; every redirect target is checked against the same domains.
AUTH_SAME_SITE sets the SameSite attribute on the cookies the server sets. none lets those cookies be set on any domain where Remark42 is shown.
The default setting does not mean Lax. It means Remark42 emits no SameSite attribute at all and leaves the choice to the browser, and browsers differ: Chromium treats a missing attribute as Lax and so refuses the cookie cross-site, while Firefox accepts it. That difference is not a detail, because it decides which of the two cookie pairs below a reader actually ends up with.
SameSite=None is not sufficient on its own, and with Remark42 on https it is not necessary either. A browser that blocks third-party cookies drops a cookie set by Remark42 for a reader on another domain no matter what its SameSite value is, unless the cookie is explicitly marked Partitioned, and Remark42's own pair is not. The widget's own pair is what closes that: the widget tells the server that it is embedded on another host, and the server sets that pair, which carries SameSite=None whatever AUTH_SAME_SITE says. The exception is Firefox's "block all third-party cookies", which discards partitioned cookies too, so nothing closes it there.
A browser that refuses a cross-site Set-Cookie lacking SameSite=None refuses it outright, so with the setting left at its default Remark42's own pair is absent from the jar in a widget on another site, not present with a stricter attribute.
What each browser actually does
Measured with Remark42 served over https on one registrable domain and the host page on another, signing in anonymously inside the widget, posting a comment, and reloading. Both hosts were local names under localtest.me and nip.io with a self-signed certificate the browsers were told to accept. Chrome 158 is the release build with its stock flags, "third-party cookies blocked" set in its settings; Firefox 161 is the release build, "block all third-party cookies" set through its cookie preference; WebKit is the build Playwright ships, which is not Safari. A cell works when the reader is still signed in after the reload and the comment is there. Email and Telegram sign-in are answered by the same server code as anonymous sign-in.
| configuration | Chrome, default | Chrome, third-party cookies blocked | Firefox, default | Firefox, "block all third-party" | WebKit build | Safari |
|---|---|---|---|---|---|---|
| neither set | works | works | works | fails | works | not measured |
AUTH_SAME_SITE=none | works | works | works | fails | works | not measured |
The automated suite also signs in inside a frame on another site with AUTH_SEND_JWT_HEADER on and off, in Chromium with third-party cookies blocked, and the session survives a reload both ways.
Which session the widget ends up with differs between the cells that work. In Chrome with third-party cookies blocked and in WebKit, the widget keeps its own pair. In Firefox with its default settings, which files Remark42's cookie under the embedding site's partition, and in Chrome with its default settings and AUTH_SAME_SITE=none, the widget sees Remark42's own session and uses that.
With the host page on another subdomain of Remark42's registrable domain, every browser and mode above kept the reader signed in, the widget kept no pair of its own, Remark42's own page showed the same reader, and signing out there signed the widget out too.
No configuration survives Firefox's "block all third-party cookies" setting. That mode discards
partitioned cookies too, so the Partitioned escape hatch does not apply. A reader who has turned
it on cannot stay signed in on an embedded widget, and nothing in Remark42 can change that.
OAuth has a table of its own. OAuth was measured in the same arrangement, with a test provider on a third registrable domain behind the custom OAuth2 provider. A cell works when, after the popup sign-in, the widget shows the account that signed in, a comment posted through it appears, and both are still there after a reload. Chrome 158 also ran in an Incognito window, and Firefox 161 in a private window and with strict tracking protection. Safari 27.2, driven through its own automation, was measured on real domains with an earlier build of the handoff, with neither variable set.
| configuration | Chrome, default | Chrome, third-party cookies blocked or Incognito | Firefox, default, private or strict | Firefox, "block all third-party" | WebKit build | Safari |
|---|---|---|---|---|---|---|
| neither set | works | works | works | fails | works | works |
AUTH_SAME_SITE=none | works | works | works | fails | works | not measured |
A provider that cuts the sign-in window off from the page that opened it, with Cross-Origin-Opener-Policy: same-origin, changed no cell, and neither did AUTH_SEND_JWT_HEADER or serving Remark42 below a path, measured earlier on real domains. Which session the widget ends up with depends on the browser, as for the other methods: in Firefox, which lets a frame use its own site's cookies after a sign-in window the frame opened unless the provider cuts that window off, and in Chrome with its default settings and AUTH_SAME_SITE=none, the widget uses Remark42's own session; everywhere else it keeps its own pair. With one account signed in on Remark42's own page and another through the widget on another site, the two stayed apart wherever the widget kept its own pair, and signing the widget out left Remark42's page signed in. Where the widget uses Remark42's own session, the two are one session: signing in as somebody else on one signs the other in as them too, and signing out of one signs out of both.
If the browser blocks the sign-in window, the widget says so and asks to allow pop-ups for the page.
With Remark42 and the host page on two subdomains of one registrable domain, OAuth works in every cell measured, as it does on Remark42's own pages: the widget there always sees the session the sign-in window set.
Here is what the common combinations of ALLOWED_HOSTS, AUTH_SAME_SITE and AUTH_SEND_JWT_HEADER give, with Remark42 on https:
- Default setup with unaltered variables: comments are shown on any domain, and every sign-in method works on them and survives a reload, except in Firefox's "block all third-party cookies", which no configuration survives.
ALLOWED_HOSTSset to a set of domains: the same, with comments shown only on listed domains. This is the recommended arrangement.AUTH_SAME_SITE=noneon top of either: the same, and in a browser that still accepts third-party cookies the widget shares Remark42's own session instead of keeping one of its own. Needed for Apple sign-in.AUTH_SEND_JWT_HEADER=trueon top of any of these: the same sessions, with the token also sent in anX-JWTheader, for clients that need it.
Over plain http none of this applies: a widget on another site gets no pair of its own, since a partitioned cookie has to be Secure.