Skip to content
Back

SSR Image Previews

  • 0
  • Web
  • Storage
  • Cloud
Krinnen
22 Oct, 2025, 21:16

I am using the SSR guide (with SvelteKit) to use Appwrite on both the server and the client. I do this by also passing the cookie back to the client and creating a separate Client on the client. This enables features like realtime and (supposedly) storage.

The problem is, that when I use the image preview API (storage.getFilePreview) the image won't load because Appwrite returns a 401. So, the problem is Appwrite doesn't get any authentication. I figured out that this happens because logging in on the client side sets a cookie on the region.cloud.appwrite.io domain, while my own cookie is on my server, so Appwrite won't see it.

Is there a way to make sure Appwrite is able to see any of my authentication cookies? I would really appreciate the help, because this is a bottleneck which may cause us to stop using Appwrite.

TL;DR
Developers are using SSR with SvelteKit and Appwrite, with authentication cookies causing issues with image previews from Appwrite's API. The problem stems from cookies being set on different domains. Solution: Ensure authentication cookies are shared across domains to allow Appwrite to access them. This can be achieved by setting the cookie domain to be visible by both the server and client-side components.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more