Перейти к основному содержимому

Настройка wildcard DNS

Wildcard DNS allows tenant subdomains like acme.yourdomain.com, techcorp.yourdomain.com, etc. This is optional — FeedbackPulse works fine with slug-based URLs (e.g., /wall/acme-corp) without wildcard DNS.


Do I Need Wildcard DNS?

ScenarioWildcard DNS needed?
Tenants use slug-based public pages (/wall/acme-corp)No
Tenants want their own subdomain (acme.yourdomain.com)Yes
Tenants bring their own пользовательский домен (feedback.acme.com)No (use CNAME instead)

What You Need

  1. A wildcard DNS A record: *.yourdomain.com → your server IP
  2. A wildcard SSL certificate: covers *.yourdomain.com
  3. Web server configuration: accepts all subdomains

Step 1: Add the DNS Record

Перейдите в your domain registrar's DNS management panel and add:

TypeName/HostValueTTL
A*123.456.789.0 (your server IP)300

You also need the regular A record for the root domain:

TypeName/HostValue
A@123.456.789.0

Provider-Specific Instructions

Cloudflare

  1. Войдите to Cloudflare Панель управления
  2. Select your domain
  3. Перейдите в DNSRecords
  4. Click Add Record
  5. Type: A | Name: * | IPv4: your server IP | Proxy: DNS only (gray cloud)
  6. Click Save

Важно: For wildcard subdomains, set Cloudflare proxy to DNS only (gray cloud), not Proxied (orange cloud). Cloudflare's free plan doesn't proxy wildcard subdomains.

Namecheap

  1. Войдите → Domain ListManage your domain
  2. Перейдите в Advanced DNS
  3. Click Add New Record
  4. Type: A Record | Host: * | Value: your server IP | TTL: Automatic
  5. Save

GoDaddy

  1. Войдите → My ПродуктыDNS for your domain
  2. Click Add Record
  3. Type: A | Name: * | Value: your server IP | TTL: 600
  4. Save

Google Domains / Google Cloud DNS

  1. Перейдите в Google Domains
  2. Select your domain → DNS
  3. Under Custom Records, add:
  4. Host: * | Type: A | Data: your server IP
  5. Save

AWS Route 53

  1. Перейдите в Route 53Hosted Zones → select your domain
  2. Click Create Record
  3. Record name: * | Record type: A
  4. Value: your server IP | TTL: 300
  5. Click Create Records

DigitalOcean DNS

  1. Перейдите в NetworkingDomains
  2. Select your domain
  3. Add: Type A | Hostname * | Will direct to: your server IP | TTL: 300

Hetzner DNS

  1. Перейдите в Hetzner DNS Console
  2. Select your zone
  3. Add record: Type A | Name * | Value: your server IP

Step 2: Get a Wildcard SSL Certificate

Option A: Let's Encrypt with DNS Challenge (Free)

Wildcard certificates from Let's Encrypt require DNS-01 challenge (not HTTP):

# Install Certbot with DNS plugin for your provider
# Example: Cloudflare
sudo apt install certbot python3-certbot-dns-cloudflare

# Create Cloudflare credentials file
sudo mkdir -p /etc/letsencrypt
sudo nano /etc/letsencrypt/cloudflare.ini

Add your Cloudflare API token:

dns_cloudflare_api_token = your_cloudflare_api_token_here
sudo chmod 600 /etc/letsencrypt/cloudflare.ini

# Get wildcard certificate
sudo certbot certonly \
--dns-cloudflare \
--dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini \
-d yourdomain.com \
-d "*.yourdomain.com"

DNS Plugins for Other Providers

ProviderCertbot PluginInstall
Cloudflarepython3-certbot-dns-cloudflaresudo apt install python3-certbot-dns-cloudflare
Route 53python3-certbot-dns-route53sudo apt install python3-certbot-dns-route53
DigitalOceanpython3-certbot-dns-digitaloceansudo apt install python3-certbot-dns-digitalocean
Google Cloudpython3-certbot-dns-googlesudo apt install python3-certbot-dns-google

Option B: Manual DNS Challenge

If your DNS provider doesn't have a Certbot plugin:

sudo certbot certonly --manual --preferred-challenges dns \
-d yourdomain.com -d "*.yourdomain.com"

Certbot will ask you to create a TXT record. Follow the prompts.

Manual challenge caveat: You'll need to manually renew every 90 days and update the DNS TXT record each time.

Option C: Paid Wildcard Certificate

Purchase from providers like:

  • Comodo/Sectigo (~$70/year)
  • DigiCert (~$400/year)
  • RapidSSL (~$125/year)

Step 3: Configure Your Web Server

See the wildcard sections in:

Key: use ServerAlias *.yourdomain.com (Apache) or server_name yourdomain.com *.yourdomain.com; (Nginx).


Step 4: Verify It Works

# Test DNS resolution for a subdomain
dig test.yourdomain.com

# Should return your server IP in the ANSWER section

# Test with curl
curl -I https://anything.yourdomain.com
# Should return a 200 or redirect (not "could not resolve host")

Step 5: Configure FeedbackPulse

Update your .env file:

# Set the session domain to allow cookies across subdomains
SESSION_DOMAIN=.yourdomain.com

# Your main app URL (without subdomain)
APP_URL=https://yourdomain.com

Note the leading dot in SESSION_DOMAIN=.yourdomain.com — this allows session cookies to work across all subdomains.


How Subdomains Work in FeedbackPulse

When a request comes in to acme.yourdomain.com:

  1. The ResolveTenant middleware extracts the subdomain (acme)
  2. It looks up the tenant with subdomain = 'acme'
  3. If found, the tenant is set as the current context
  4. The user sees the tenant's login page or dashboard

Tenants set their subdomain during registration. You can also set it manually in the панель администратора.


Следующие шаги