[SOLVED] How to allow appwrite to accept requests from localhost?
- 0
- Resolved
- Self Hosted
- Web
- Cloud
When I added a platform to my project I specifed localhost as the hostname. But when making requests I get this error:
Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Localhost is allowed by default. You're probably getting that error for some other reason...like incorrect project id. Or you don't have access to whatever API you're hitting.
Share the network logs if you still need help
I double checked and re-copied the correct IDs into my env file. In terms of services, I have everything enabled except for GraphQL. When I looked at the network tab this is really all I saw:
Request URL: https://cloud.appwrite.io/v1/account
Request Method: POST
Status Code: 404
Referrer Policy: strict-origin-when-cross-origin
On my frontend I'm just calling:
const userAccount = await account.create(
ID.unique(),
email,
password,
`${firstname} ${lastname}`
);
Also, just wondering, on my self-hosted instance of appwrite, what should I do to also allow localhost just like you say localhost is allowed by default on the cloud solution?
Ah, I figured out the issue - my env was named something like APPWRITE_PROJECT_ID which was fine because I initially was doing my appwrite calls from the backend but since I am moving the calls over to the frontend, I needed to use NEXT_PUBLIC_APPWRITE_PROJECT_ID.
[SOLVED] How to allow appwrite to accept requests from localhost?
Recommended threads
- TEAM INVITE
There is a problem with the team invitation. When a user invites other users, that time, the newly created email address they don't get the invite link and old ...
- education plan not activated
Hi I have an edu id 13103046@iubat.edu but when I am trying to claim my plan and trying to logging with github where education student plan active. the appwrite...
- I'm getting an error on the console "j?....
On my self hosted instance version 1.8.1 the console is giving me this error when trying to view the rows for a table I recently created. My application is read...