Rank 2: Process
But then the base app would be unsecured
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
But then the base app would be unsecured
Rank 2: Process
Or would that be solved by NPM (Nginx Proxy Manager) ?
are you saying your front end app is not connecting to console.whatever?
do you also have NPM in front of appwrite?
Rank 2: Process
Well, I'm kind of cheating, because I also redirecting myapp.mydomain.tld/v1/ to be served by the appwrite service in the traefik config. Because I don't have yet an certificate for console., the app would not work without this
Rank 2: Process
Not yet, but I'm planning on adding it
👀 this doesn't really sound right...
probably best to set this up first especially if you're already hosting multiple apps on the same server. and if you're using NPM, Appwrite's certificates wouldn't really matter
Rank 2: Process
Great, I'll set it up then
_APP_DOMAIN should be your main domain (like console.whatever). For project specific endpoints, you can use custom domains (https://appwrite.io/docs/custom-domains). But, like I said, if you're using NPM, you may not need to add a custom domain since NPM would handle the certificate generation.
For using NPM in front of Appwrite, you can refer to this: https://medium.com/@stnguyen90/how-to-run-appwrite-behind-nginx-19348ed34243
Rank 2: Process
Awesome! Thanks a lot!! 💯 👏
Rank 2: Process
I didn't understand this from the article:
How do I get this IP, if it's running on the same server ?
Rank 2: Process
Is it 127.0.0.1, even though it's inside of docker ?
not 127.0.0.1
Rank 2: Process
is the public IP of the server ?
so traefik and NPM should be in the same docker network and have an IP address in that network. You can run docker inspect <network> to get the containers in the network
Rank 2: Process
Good, I'll try that
Rank 2: Process
Is it (1) IPAM.Config[0].Gateway or (2) Containers.{ID}.IPv4Address ? Option (2) has a "/16" subnet mask after the address, does it work with that ?
it would be the IPv4 Address without the subnet mask
Rank 2: Process
Got it
Rank 2: Process
I got the domains working with https in NPM, in the console everything works.
But when the frontend app calls the console endpoints, there are some cors errors.
The frontend calls this:
GET https://console.myapp.mydomain.tld/v1/account
origin: https://myapp.mydomain.tld
referer: https://myapp.mydomain.tld/
In the devtools logs:
Access to XMLHttpRequest at 'https://console.myapp.mydomain.tld/v1/account' from origin 'https://myapp.mydomain.tld' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://localhost' that is not equal to the supplied origin.
It's very strange because before the GET /v1/account, the browser sends an OPTIONS /v1/account, and on the Options method the server replies with the right access-control-allow-origin: https://myapp.mydomain.tld.
But when the browser calls the Get method, for some reason the server replies with access-control-allow-origin: https://localhost, which I don't understand why. It doesn't appear to be related to NPM because it works in the Option method, but I dunno.
Did you add the hostname for your app as a web platform for your project in the Appwrite console?
Rank 2: Process
Maybe not, I'll see
Rank 2: Process
Yes, that solved it! Thanks again 👍
[SOLVED] Error when logging to console after account created in Chrome