Auth endpoints returning 404 behind Cloudflare Tunnel

Hi there! I've just made my first Better Auth website using SvelteKit. I'm trying to now set it up on my domain through a Cloudflare Tunnel to my home server. I've followed the SvelteKit guide for setting up Better Auth and it worked while developing when the auth URL in the .env file was set to my local IP. However, when I set up the Cloudflare Tunnel, set the better auth url to my website's public URL, then try to interact with any of the auth endpoints, I just get 404s. I can see in the server console:
Not found: /api/auth/get-session
Not found: /api/auth/sign-in/social
Not found: /api/auth/get-session
Not found: /api/auth/sign-in/social
and in the browser console:
• Failed to load resource: the server responded with a status of 404 (
https://(mydomain)/api/auth/get-session
• Failed to load resource: the server responded with a status of 404 (
https://(mydomain)/api/auth/sign-in/social
• Failed to load resource: the server responded with a status of 404 (
https://(mydomain)/api/auth/get-session
• Failed to load resource: the server responded with a status of 404 (
https://(mydomain)/api/auth/sign-in/social
I'm not sure where to go from here - I've tried setting the better auth URL to the server's internal IP, but then it just tries to call the auth endpoints from that local IP which won't work externally. Has anyone else experienced this and could have a possible fix? Thank you! šŸ˜„
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?