Description
Hey, here's our use-case:
We're using next's domain routing to serve different locales from different domains. If you hit our englishdomain.com/fr
, nextjs will redirect you to our frenchdomain.com
homepage. Great!
The problem we're having is that the next-drupal module only supports a single domain for previewing. So if we enter the englishdomain.com/api/preview
for this, it works fine when previewing english content.
If we preview french content though (or any other locale), we momentarily see our updated content in the iframe but then it immediately gets redirected to the page at the french domain, at which point next.js doesn't know it's supposed to be showing preview content anymore.
In point form:
- Drupal requests
https://englishdomain.com/api/preview?slug=/fr/whatever
with all the rest of the query params needed. - Next.js handles this, generates the previewData, then sends the user to
https://englishdomain.com/fr/whatever
. At this point we can see the preview data. - Next.js then recognizes that we're on
/fr
at the english domain, and redirects tohttps://frenchdomain.com/whatever
at which point preview data is gone.
So maybe there is a way to get next to not redirect when it knows it's got previewData, which is probably easiest, or maybe the Drupal module could support an array of previewUrls, one per locale enabled in your translation settings.