Hello all, this is my first time posting. I've got read a bunch of article already but I'm still stuck. The problem was about the OAuth redirect_uri.
Upon investigation, when my Appwrite server instance sends OAuth to providers, instead of sending "HTTPS", it sends "HTTP" as protocol for the redirect_url.
My Appwrite instance is running inside my self-hosted server and served via Cloudflare tunnel. I already tried applying host rewrite on my apache configuration but without any luck.
I've attached the screenshots for reference.
Thanks,
is your apache forwarding to HTTPS?
Hi Steven, yes, it is. This is my apache config currently:
ServerAdmin admin@coffeeandpaste.co
ServerName appwrite.coffeeandpaste.co
ProxyPreserveHost On
ProxyPass / http://localhost:5003/
ProxyPassReverse / http://localhost:5003/
RewriteEngine On
RewriteCond %{HTTP_HOST} !^appwrite\.coffeeandpaste\.co$ [NC]
RewriteRule ^(.*)$ https://appwrite.coffeeandpaste.co$1 [R=301,L]
</VirtualHost>```
Is the endpoint of when you're creating the GitHub OAuth 2 is HTTP or HTTPS?
it's HTTPS, I just copied the callback URL provided from the Appwrite console portal
I mean where you running the createOAuth2Session('github')
Your frontend
ah yes from my frontend
which is serving locally as of the moment
That's fine but as I saw through the code if this endpoint is not https then the redirects won't be https either So, Create another tunnel to the front end, and give it a try I think it will solve it
Thanks @Binyamin , I'll try to deploy the frontend to my server and see if it works
hi @Binyamin , it's still the same, here's the URL of the frontend: https://angular.coffeeandpaste.co/
It gives me an errro
The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application
You need to add or change so the https://angular.coffeeandpaste.co/ would be the webapp url
your ProxyPass is to http:// rather than https:// 🧐
Yes @Steven is correct (oc)
The AppWrite engine get the request protocol as http
Hi Steven, I'm ProxyPassing the Appwrite instance served on the docker-compose inside my server, that's why it's http://localhost... Maybe I'll check if I can also forward the origin protocol and use it on the proxy. I'll update this post later. Thanks for all your help 😄
it would be best to proxy to HTTPS.
See: https://github.com/appwrite/appwrite/discussions/4056#discussioncomment-3784116
Hi Steven and byawitz, using "http" instead of "https" on the OAuth's callback URL works. Also adding success URL on createOAuth2Session() made things work as expected.
Thank you very much!
👍
Recommended threads
- Having issues with Goggle Authentication...
My google auth is not redirecting me to my failureurl. I think it might be a session issue because it's working in my laptop but when I try it in another laptop...
- coolify docs dont help installing latest...
coolify has older version of appwrite, how do i install latest version of appwrite
- I'm getting error Invalid `url` param: I...
``` 2025-10-26T12:52:02.292Z [error] AppwriteException: Invalid `url` param: Invalid URI. Register your new client (vercel.com) as a new Web platform on your pr...