Single Domain Setup
For a single domain setup, you need to configure two essential environment variables:WEBAPP_URL
: The base URL of your Formbricks instance (serves both admin and public content)NEXTAUTH_URL
: The authentication URL (should be the same as WEBAPP_URL)
Example Configuration
Important Notes
- Both URLs must be the same for authentication to work properly
- The URLs should be the full URL including the protocol (http:// or https://)
- Make sure your domain is properly configured in your DNS settings
- If you’re using HTTPS (recommended), ensure you have valid SSL certificates installed
Public / Private Domain Split
Formbricks supports a powerful domain separation feature that allows you to serve public content (surveys, public APIs) from a different domain than your private admin interface. This provides enhanced security and better organization. It enables you to:- Serve public content (surveys, public APIs) from a different domain than your private admin interface
- Restrict admin functionality to the private domain
- Ensure authentication and sensitive operations only occur on the private domain
Publicly available images uploaded before the domain split (logos, images in Picture Select questions, etc.) will continue to be served from the Private Domain. To protect your Private Domain, please reupload public images after the successful setup of the domain split.
Why Use Domain Split?
- Enhanced Security: Separate public-facing surveys from your admin interface
- Better Organization: Use dedicated domains for different purposes (e.g.,
admin.company.com
for management,surveys.company.com
for public surveys)
Configuration
To set up Public/Private Domain Split:- Private Domain (WEBAPP_URL): Your admin/management interface
- Public Domain (PUBLIC_URL): For surveys and public-facing content
Example Configuration
How It Works
When PUBLIC_URL is configured:- Admin Interface: All admin/management functions are served from
WEBAPP_URL
- Public Surveys: All survey links and public APIs use
PUBLIC_URL
- SDK Integration: The public domain is used for all client-side SDK connections
- Email Links: Survey invitation emails use the public domain
- Sharing Features: Survey sharing uses the public domain
Routes Available on the Public Domain
When PUBLIC_URL is configured, the following routes are automatically served from the public domain:Survey Routes
/s/{surveyId}
- Individual survey access/c/{jwt}
- Personalized link survey access (JWT-based access)- Embedded survey endpoints
API Routes
/api/v1/client/{environmentId}/*
- Client API endpoints (v1)/api/v2/client/{environmentId}/*
- Client API endpoints (v2)
Static Assets & Next.js Routes
/favicon.ico
- Favicon/_next/*
- Next.js static assets and build files/js/*
- JavaScript files/css/*
- CSS stylesheets/images/*
- Image assets/fonts/*
- Font files/icons/*
- Icon assets/public/*
- Public static files
Storage Routes
/storage/{environmentId}/{accessType}/{fileName}
- Public file storage access
Health & Monitoring
/health
- Health check endpoint
Sharing & Embed Routes
- Survey sharing endpoints
- Embed widget routes
- Social sharing endpoints
WEBAPP_URL
) for security purposes. The admin domain can access the health endpoint (/health) and public file storage (/storage/{environmentId}/{accessType}/{fileName}
), while all other public routes are exclusively accessible on the public domain (PUBLIC_URL
) and will return a 404 error if accessed from the admin domain.
App URL SDK Configuration
Multi-Domain Setup SDK Configuration
When using PUBLIC_URL (multi-domain setup), all SDK configurations must use the public domain:DNS and SSL Configuration
- Set up DNS records for both domains
- Configure SSL certificates for both domains
- Update your reverse proxy (nginx, Apache, Cloudflare, etc.) to route both domains to your Formbricks instance
- Firewall rules: Ensure both domains can reach your Formbricks instance
Fallback Behavior
IfPUBLIC_URL
is not set:
- All content (admin and public) is served from
WEBAPP_URL
- The system behaves as a single domain setup
- No domain separation occurs
Reverting to a Single Domain
While it’s possible to revert to a Single Domain setup, please take into account the following:- All image links and uploaded files are stored in the database, so they will continue to link to the Public Domain hence the links will break. You’ll need to reupload the images, like you did when you set up the domain split.
- Any survey link shared to with the Public Domain will break.
- API calls to the Public Domain will break, unless updated.