Gatsby Prismic preview only working on localhost

I am also using AWS Amplify for hosting.

I have found that the trailing slash alone did not work for my previews.

By adding the following redirect rule to Amplify has fixed the preview issue for me, together with adding the trailing slash in the Prismic preview configuration /preview/

{
    "source": "/preview/<type>?uid=<uid>",
    "target": "/preview/<type>/?uid=<uid>",
    "status": "302",
    "condition": null
}

The main issue I am facing now is that prismic sets all my preview urls to “content_page” rather than their appropriate content type names.

Eg /preview/content_page/?uid=blog should actually be /preview/blog_page/?uid=blog

So this results in the preview being blank. If I manually change the URL, the correct preview is shown.

2 Likes