I'm trying to implement Prismic preview in a Next.js application. I'm using Server-side Rendering with getServerSideProps.
When I run the code locally, the preview works perfectly. However, when deployed into production (running over https) I just get 404 page not found.
I was following the troubleshooting steps here and
the preview script is loaded into the application.
the preview cookie io.prismic.preview is present.
I'm able to make a request to https://my-repo-name.prismic.io/api/v1/documents/search?ref=the-value-in-your-cookie and get a complete result.
The troubleshooting suggests, that if this far it works, then the problem is in the code.
However, I'm confused since the same code works fine locally.
Is there something else I could check? Any idea would be helpful, thank you!
P.S. Unfortunately I cannot share the complete source code for confidentiality reasons.