Preview works in localhost, but not in production (Next.js)


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 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.

A post was merged into an existing topic: Preview not working on netlify