Skip to content
Init is coming / May 19 - 23
Back

CORS issue with cloudlfared tunnel

  • 0
  • Self Hosted
D5
12 May, 2025, 11:08
TL;DR
Developers are experiencing issues with CORS using a Cloudflared tunnel and Appwrite. They are trying to connect their frontend files hosted on a domain to a locally hosted Appwrite container. The solution involves ensuring a correct DNS A record pointing to the Appwrite instance, setting the appropriate endpoints, checking for headers in the responses, setting the env var to the domain, and configuring Custom Domain in Appwrite project settings. They should also review the provided blog post for additional guidance.
now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:09

ah okay, I'll take a look ty

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:10

over here?

D5
12 May, 2025, 11:11

Only 1

D5
12 May, 2025, 11:12

That should be the IP I think

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:13

ah okay, do you mean the ip address of the server hosting my domain?

D5
12 May, 2025, 11:13

127.0.0.1

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:16

I'm still getting the cors error, is there maybe something else I could have done wrong?

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:17

No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

actually there wasn't a header present this time

D5
12 May, 2025, 11:17

Hmmm interesting. What's the code?

Cord
12 May, 2025, 11:17

@D5 Wouldn't the hostname need to be "api.apoth.dev" for the Platform?

D5
12 May, 2025, 11:18

Nope. That's the appwrite hostname, not the frontend hostname to my understand

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:18

window.client = new Appwrite.Client() .setEndpoint('https://api.apoth.dev/v1')

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:18

a snippet from the auth.js I use to log users in

D5
12 May, 2025, 11:19

Looks like your endpoint is not pointing to appwrite

D5
12 May, 2025, 11:20

But to a litespeed 404 page

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:20

ah okay

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:20

litespeed would be my hosting.com account then

D5
12 May, 2025, 11:21

Yes, it's not pointing to appwrite correctly. Make sure you have only one DNS A record pointing to your appwrite instance for that subdomain

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:22

one dns A record pointing to ('https://api.apoth.dev/v1') ?

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:22

will give that a wirl

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:23

I only have a cname atm for the api subdomain of my main domain which was auto generated by my cloudflared tunnel

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 11:57

still having the same issues, could anything else be causing my endpoint to be broken?

D5
12 May, 2025, 11:58

An A record pointing to your appwrite instance IP address

now my pc is dead bruhhawl;dkjaw
12 May, 2025, 12:00

oh so an A record in my cloudflare dns for api.mydomain.com to 127.0.0.1:80?

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