Back

Flutter/Appwrite SSL connection

  • 0
  • Self Hosted
  • Flutter
  • Web
tahakhawaja
6 Sep, 2023, 05:26

My flutter website currently uses Appwrite as a backend. Until now i've been able to send requests to Appwrite and everything was working perfectly fine. I've now installed and set up a SSL certificate using Lets Encrypt and now instead of "demo.edventures.ai" my website is able to be accessed using "https://demo.edventures.ai". However now when I send requests from my https site, I get this error. How can I fix it?

main.dart.js:45239 Mixed Content: The page at 'https://demo.edventures.ai/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://178.128.196.153/v1/account'. This request has been blocked; the content must be served over HTTPS.

TL;DR
The user wants to know if they can use their current domain for their Appwrite backend or if they need a separate domain. It is recommended to use a subdomain for the Appwrite backend. The user is also asking for instructions on how to set up SSL certificates for Appwrite. Appwrite can generate an SSL certificate automatically if the domain is set up and pointing at Appwrite. The user is also experiencing an error when sending requests from their HTTPS site to the Appwrite backend. This is due to mixed content and can be fixed by setting up HTTPS on the server where Appwrite is running.
safwan
6 Sep, 2023, 05:46

Well I assume that's the expected behaviour when you send requests from an app served with HTTPS, to an app served on HTTP

safwan
6 Sep, 2023, 05:47

Considering http://178.128.196.153/ is where appwrite is running, you will probably need to setup HTTPS on this server

safwan
6 Sep, 2023, 05:48

FYI, it's best to use a proxy like nginx to create what are called "proxy hosts"

tahakhawaja
6 Sep, 2023, 06:43

Is there any documentation available to do this on appwrite?

Also does this mean I will need to install a SSL certificate on the appwrite server itself? I currently use Nginx for my flutter SSL

ideclon
6 Sep, 2023, 11:26

If you have a domain set up and pointing at Appwrite, Appwrite can generate an SSL certificate automatically. Just set the domain in __APP_DOMAIN

tahakhawaja
6 Sep, 2023, 16:05

Are there instructions available for this in appwrite documentation?

ideclon
6 Sep, 2023, 17:11

Instructions for what?

Drake
6 Sep, 2023, 17:54
tahakhawaja
8 Sep, 2023, 04:47

does this domain need to be my external website that uses appwrite as a backend, or do I need an entirely separate domain specifically for my Appwrite backend? My appwrite backend is currently self-hosted on a digital ocean droplet, and I currently access it using the public IP address provided by the digital ocean droplet.

Drake
8 Sep, 2023, 04:50

Why can't you set up appwrite.demo.edventures.ai to point to your droplet?

tahakhawaja
8 Sep, 2023, 04:51

So my main domain is currently "edventures.ai" and the subdomain my flutter website uses is "demo.edventures.ai". I just wanted to clarify if it was okay to use the current domain, or whether I needed to use a separate one. In this case, I will likely be using "appwrite.edventures.ai". Does this seem like an appropriate solution based on your knowledge?

Drake
8 Sep, 2023, 05:32

Appwrite should be a subdomain of your app. So if your app is demo.whatever, Appwrite should be on appwrite.demo.whatever

alza
8 Sep, 2023, 07:43

Thank you @Steven ! I’m working together w Taha so I’m jumping into the conversation.

Our plan is to only use the demo.edventures domain for as long as we’re testing the app and until we’ve developed a full MSP. Once we’ve developed the MSP, we plan on having the app under ‘app.edventures.ai’ or something like that as a permanent subdomain for the webapp.

To make it easier for us, and not having to change the domain of our Appwrite backend/server, wouldn’t it be better to give our Appwrite backend a subdomain of its own (for example, "appwrite.edventures.ai")? Or would that complicate things for how the Appwrite backend runs?

Drake
8 Sep, 2023, 16:06

As I mentioned, you should use a custom domain for the domain your app is connecting to where the domain is a subdomain of your app

it should be pretty easy to add additional subdomains in Appwrite and for your app.

alza
8 Sep, 2023, 16:06

alright, thank you!

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