Back

Is there a lag when adding / editing a platform?

  • 0
  • Web
  • Cloud
Rich
17 Aug, 2023, 15:49

I originally had only 1 platform set up - localhost. I tried adding a second platform with my actual domain but when I tried logging in I got a cors error.

I then tried editing my localhost platform to my domain, and it still allowed me to log in on my local dev.

When I change both platforms to my domain, in the error message there is still a reference to localhost:

Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account/sessions/email' from origin 'https://www.mydomain.co.uk' 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.

Is there a delay in changes taking effect?

TL;DR
User is experiencing a CORS error when trying to log in from the deployed app. They have tried adding/editing platforms and are still getting the error. Other users suggest checking network logs and deleting browser/cloud cache. User also mentions a mix-up with project IDs. No concrete solution is provided in the thread.
D5
17 Aug, 2023, 15:57

Uh, not sure, but tried doing this and I don't get lag or anything

Rich
17 Aug, 2023, 16:11

It seems like my account isn't updating then

D5
17 Aug, 2023, 16:12

Are you getting more errors apart from CORS?

Rich
17 Aug, 2023, 16:25

No errors. I have just deleted both platforms from my account, so there are none, and it is still letting me log in. That can't be right can it?

D5
17 Aug, 2023, 16:26

Uh usually login is not affected/protected by cors

Rich
17 Aug, 2023, 16:26

Just to double check I commented out the setEndpoont and setProject lines in my app and only then it failed (as expected)

D5
17 Aug, 2023, 16:27

Could you please send here the code it's giving you the errors?

Rich
17 Aug, 2023, 16:27
Rich
17 Aug, 2023, 16:30

my login component (React Next)

Rich
17 Aug, 2023, 17:28

To reiterate, everything works fine locally and I can log on to my app using the AppWrite cloud.

When I try to log on from my deployed app I get:

Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account/sessions/email' from origin 'https://www.growthpathways.co.uk' 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.

And this is whether I have no platforms added, or a localhost platform, or platform specifying my domain.

I do not get any other errors from code.

safwan
17 Aug, 2023, 17:31

have you tried deleting the cache in cloud?

safwan
17 Aug, 2023, 17:31

not sure what the issue is, but worth a try i guess?

Rich
17 Aug, 2023, 17:55

i've deleted browser cache, how do i delete cache in cloud?

safwan
17 Aug, 2023, 18:55

Yes that's what I meant, sorry!

safwan
17 Aug, 2023, 18:56

Did that fix the issue by any chance?

Rich
17 Aug, 2023, 19:13

no it didn't

D5
17 Aug, 2023, 19:28

Are you using any kind of server side rendering?

Drake
17 Aug, 2023, 20:18

localhost works by default.

any other web app will require a platform set.

Would you please look at network logs in your browser and share the request headers?

Tigertek
18 Aug, 2023, 13:26

i had same cors issue today and after much hair pulling i had the wrong project id. Works fine again now

Rich
18 Aug, 2023, 19:07

Weird, the problem has developed a little bit. I eventually got it working on my domain, however as soon as I applied Let's Encrypt free SSL certificate the Cors error is back.

This is my server config:

TypeScript
server {
    server_name growthpathways.co.uk www.growthpathways.co.uk;

    location / {
        proxy_pass http://localhost:3000; # Assuming your Next.js app runs on po>
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/growthpathways.co.uk/fullchain.pem; # >
    ssl_certificate_key /etc/letsencrypt/live/growthpathways.co.uk/privkey.pem; >
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = www.growthpathways.co.uk) {
 return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = growthpathways.co.uk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name growthpathways.co.uk www.growthpathways.co.uk;
    return 404; # managed by Certbot

}

This is my error:

Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account/sessions/email' from origin 'https://www.growthpathways.co.uk' 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.

Also works fine logging in from localhost, or from my servers IP address (I have 3 platforms set up on AppWrite for localhost, server IP, and domain)

Rich
18 Aug, 2023, 19:10

It's ok I have just tried it on another device and it worked so maybe the new issues is a caching problem on my laptop.

Thanks everyone for the help. I can't 100% say what the error was but I think there was some issue with the build and a mix up of Project ID's like Tigertek somewhere down the line too

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