Back

[SOLVED] 401 (Unauthorized) on Appwrite through Cloudflare Tunnel

  • 1
  • Self Hosted
Meli
30 Dec, 2023, 02:55

I ran Appwrite on my local Ubuntu Server, works fine locally. However, when accessing it through a Cloudflare tunnel, I can't log in.

I tried disabling Cloudflare's Proxy (DNS only) and adjusting the .env file to mydomain.com or subdomain.mydomain.com or localhost with the same result.

The cloudflare tunnel is connecting with cloudflared which is also running on docker.

TL;DR
[SOLVED] 401 (Unauthorized) on Appwrite through Cloudflare Tunnel. The issue appears to be related to the SSL/HTTPS certificate. Accessing the domain via HTTP works, but not HTTPS. Try generating a self-signed cert and configure Cloudflare to only trust that cert for better security.
Meli
30 Dec, 2023, 02:57

*I'm unable to login even tho "Succesfully logged in" shows up

Drake
30 Dec, 2023, 05:19

Did you run docker compose up -d to apply the change to the .env file?

Meli
30 Dec, 2023, 14:25

Yes! Still unauthorized, am I missing something πŸ€”, has anyone else worked with Appwrite through a cloudflare tunnel?

sourabpramanik
30 Dec, 2023, 17:19

Try removing the volumes after stopping the containers

Drake
30 Dec, 2023, 18:21

What version of Appwrite?

Meli
30 Dec, 2023, 21:56

1.4.13

ideclon
30 Dec, 2023, 22:20

Yes, and I’ve never seen something like this happen

Meli
30 Dec, 2023, 22:28

It appears to be related to the SSL/HTTPS certificate. I experimented with Tailscale Funnel (a service similar to Cloudflare Tunnels) and found that I can log in when the domain is accessed via HTTP but not when using HTTPS.

ideclon
30 Dec, 2023, 22:31

Interesting. What about when accessing it via CF over HTTP?

Drake
30 Dec, 2023, 22:31

I typically suggest using https throughout the whole flow

Meli
30 Dec, 2023, 22:56

I have no idea what I'm doing, but in case someone has the same issue while using cloudflare tunnels with Appwrite:

Guille
30 Dec, 2023, 23:26

[SOLVED] 401 (Unauthorized) on Appwrite through Cloudflare Tunnel

ideclon
31 Dec, 2023, 00:14

Or for better security, you could generate a self-signed cert and tell CF to only trust that cert

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