Skip to content
Back

Avatar URLs are using server IP address instead of configured domain

  • 0
  • Self Hosted
  • Web
sudarsan25
29 Nov, 2025, 02:22

Issue: Avatar URLs are using server IP address instead of configured domain Environment:

Appwrite Version: 1.8.0 Setup: Self-hosted on Google Compute Engine with Cloudflare Tunnel Domain: <your-domain> Frontend: Firebase Hosting at <your-frontend-domain>

Problem: The avatars.getInitials() endpoint is generating URLs with the server's IP address instead of the configured domain:

Current (wrong): http://<public-ip>/v1/avatars/initials?name=User&project=<project-id> Expected: https://<your-domain>/v1/avatars/initials?name=User&project=<project-id>

This causes:

ERR_CERT_AUTHORITY_INVALID errors (IP has no SSL cert) Mixed content warnings (HTTP images on HTTPS page) Blocked image requests

Configuration: All environment variables are correctly set in both .env and docker-compose.yml: bash_APP_DOMAIN=<your-domain> _APP_DOMAIN_TARGET=<your-domain> _APP_DOMAIN_FUNCTIONS=<your-domain> _APP_ENDPOINT=https://<your-domain>/v1 Verified: bashdocker exec -it appwrite printenv | grep APP_DOMAIN

Shows all domain variables are correct

Steps Taken:

Restarted Appwrite multiple times Cleared browser cache Added platform for frontend domain in Appwrite console Verified Cloudflare Tunnel is working correctly (other API endpoints work fine)

Question: Why is the avatar service still generating URLs with the IP address? Is there a cached value in the database or a specific configuration for the avatar service we're missing?

TL;DR
Developers are encountering an issue where Avatar URLs are using the server's IP address instead of the configured domain. The problem stems from the `client.setEndpoint()` method passing an IP address. To resolve this, ensure that the correct domain is passed to the `client.setEndpoint()` method.
sudarsan25
29 Nov, 2025, 02:23

I been in the issue from yesterday

sudarsan25
29 Nov, 2025, 02:25

My appwrite is self hsoted in gcp and I have used cloudfalre tunnel for it.Console is opening from my subdomain adn data are allso being fetch from db.But avatar are not showing

Steven
29 Nov, 2025, 02:44

You're passing an IP address into client.setEndpoint()

Steven
29 Nov, 2025, 02:45

Get initials doesn't make any api call. It just builds the url and returns it. See https://github.com/appwrite/sdk-for-web/blob/de72141ece55b1eb4e8d14b8bf429c3b8bf690ce/src/services/avatars.ts#L461

sudarsan25
29 Nov, 2025, 02:52

No,I am not passing .I am passing subdomain url.import { Client, Account, Databases, Storage, Avatars } from 'appwrite'

export const appwriteConfig = { projectId: import.meta.env.VITE_APPWRITE_PROJECT_ID, url: import.meta.env.VITE_APPWRITE_URL, databaseId: import.meta.env.VITE_APPWRITE_DATABASE_ID, storageId: import.meta.env.VITE_APPWRITE_STORAGE_ID, userCollectionId: import.meta.env.VITE_APPWRITE_USERS_COLLECTION_ID, postCollectionId: import.meta.env.VITE_APPWRITE_POSTS_COLLECTION_ID, savesCollectionId: import.meta.env.VITE_APPWRITE_SAVES_COLLECTION_ID, commentsCollectionId: import.meta.env.VITE_APPWRITE_COMMENTS_COLLECTION_ID, followCollectionId: import.meta.env.VITE_APPWRITE_FOLLOW_COLLECTION_ID }

export const client = new Client(); client.setProject(appwriteConfig.projectId) client.setEndpoint(appwriteConfig.url)

export const account = new Account(client); export const databases = new Databases(client); export const storage = new Storage(client); export const avatars = new Avatars(client);

sudarsan25
29 Nov, 2025, 02:53

environment variable is set and I have rebuild and deplyed too by clearing cache.Everyone is requesting in subdomainurl but while fetching avatar url,it using http:<my public ip>

Steven
29 Nov, 2025, 02:55

Before you call avatars.getInitials() can you log avatars.client.config?

And can you confirm which Appwrite SDK you're using and what version?

sudarsan25
29 Nov, 2025, 02:59

I need some time

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