Skip to content

DNS y dominios

HUMAE vive en cuatro subdominios de humae.com.mx. Esta página describe qué registros DNS debes crear y cómo configurar SSL.

Mapa de subdominios

SubdominioApunta aDescripción
humae.com.mxFrontend (Next.js)Landing pública + app autenticada
www.humae.com.mx→ redirect a humae.com.mxAlias canónico
api.humae.com.mxBackend (Laravel)API REST v1 + webhooks
docs.humae.com.mxEste manual (VitePress)Documentación

Proveedor de DNS

Recomendado: Cloudflare (free tier cubre todo lo que necesita HUMAE y ofrece proxy, DDoS protection, analytics gratis).

Alternativas: Route 53, Vercel DNS, DigitalOcean DNS.

Registros DNS

Para el frontend (humae.com.mx + www)

Depende del host de despliegue:

text
# Raíz — A record al load balancer de Vercel
Type: A
Name: @
Value: 76.76.21.21
TTL: Auto

# www — CNAME
Type: CNAME
Name: www
Value: cname.vercel-dns.com
TTL: Auto
text
# Cloudflare maneja esto automáticamente si agregas el dominio desde el dashboard
# Paso manual si usas otro DNS:
Type: CNAME
Name: @
Value: humae-frontend.pages.dev
TTL: Auto
Proxy: Enabled (orange cloud)
text
Type: A
Name: @
Value: 75.2.60.5

Type: CNAME
Name: www
Value: humae.netlify.app
TTL: Auto

Para el backend (api.humae.com.mx)

Depende del host:

text
Type: A
Name: api
Value: <IP pública del servidor>
TTL: Auto
Proxy: Cloudflare Proxy OFF (webhooks de Stripe requieren IP directa)
text
Type: CNAME
Name: api
Value: humae-backend.onrender.com
TTL: Auto
text
Type: CNAME
Name: api
Value: humae-backend.up.railway.app
TTL: Auto
text
Type: A
Name: api
Value: <IP del droplet>
TTL: Auto

Cloudflare Proxy con webhooks

Si usas Cloudflare como proxy (orange cloud) para api.humae.com.mx, asegúrate de que los webhooks de Stripe NO sean bloqueados por las reglas del WAF. Agregar regla de bypass para POST /api/webhooks/*.

Para los docs (docs.humae.com.mx)

text
Type: CNAME
Name: docs
Value: humae-docs.pages.dev   # o .vercel.app / .netlify.app según host
TTL: Auto

Correo (SPF + DKIM + DMARC para el SMTP local)

Como HUMAE envía correo desde su propio Postfix, los registros apuntan a la IP del servidor (no a un SaaS):

text
# A
Type: A
Name: mail
Value: <IP-DEL-SERVIDOR>
TTL: Auto

# SPF
Type: TXT
Name: @
Value: v=spf1 ip4:<IP-DEL-SERVIDOR> ~all
TTL: Auto

# DKIM (llave pública generada por opendkim-genkey)
Type: TXT
Name: default._domainkey
Value: "v=DKIM1; k=rsa; p=MIIBIjANB..."
TTL: Auto

# DMARC
Type: TXT
Name: _dmarc
Value: v=DMARC1; p=none; rua=mailto:dmarc@humae.com.mx
TTL: Auto

Además se requiere PTR (reverse DNS) apuntando de la IP del servidor a mail.humae.com.mx; eso se configura en el panel del provider de la IP, no en el DNS del dominio.

Opcional pero recomendado — MX records para recibir correos en humae.com.mx:

text
# Si usas Google Workspace
Type: MX
Name: @
Priority: 1
Value: smtp.google.com
TTL: Auto

Verificación de propagación

bash
# Registros A
dig humae.com.mx A +short
dig api.humae.com.mx A +short

# Registros CNAME
dig www.humae.com.mx CNAME +short
dig docs.humae.com.mx CNAME +short

# TXT (SPF, DMARC)
dig humae.com.mx TXT +short
dig _dmarc.humae.com.mx TXT +short

# TXT DKIM (OpenDKIM local)
dig default._domainkey.humae.com.mx TXT +short

# PTR (reverse DNS de la IP del servidor)
dig -x <IP-DEL-SERVIDOR> +short
# → debe devolver mail.humae.com.mx

Propagación global: suele tomar 5–30 min, hasta 24h en casos extremos.

SSL / TLS

Todos los subdominios deben servirse por HTTPS. Opciones:

Opción A — Cloudflare (recomendada)

  1. Agregar dominio a Cloudflare (cambiar nameservers en el registrador a los de Cloudflare).
  2. SSL/TLS mode: Full (strict).
  3. Cloudflare emite certificado wildcard automáticamente.
  4. Activar Always Use HTTPS y Automatic HTTPS Rewrites.

Opción B — Let's Encrypt (self-hosted)

En el servidor backend:

bash
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d api.humae.com.mx
# Renovación automática
sudo systemctl enable certbot.timer

Para el frontend en VPS, idem.

Opción C — Certificados gestionados por el host

  • Vercel: SSL automático, wildcard.
  • Netlify: SSL automático, Let's Encrypt.
  • Cloudflare Pages: SSL automático.
  • Render: SSL automático.
  • Railway: SSL automático.

En todos estos, no tienes que hacer nada — el host se encarga.

Redirects y canonical

Debes configurar:

  1. http://https:// (redirect 301 permanente).
  2. www.humae.com.mxhumae.com.mx (o al revés, elige uno canonical).

Ejemplo nginx para el backend:

nginx
# Redirigir HTTP a HTTPS
server {
    listen 80;
    server_name api.humae.com.mx;
    return 301 https://$server_name$request_uri;
}

# Forzar HTTPS y canonical
server {
    listen 443 ssl http2;
    server_name api.humae.com.mx;
    # ... SSL config ...

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;

    root /var/www/humae_backend/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
}

Health checks externos

Configurar uptime monitoring gratuito:

  • UptimeRobot (free 50 monitors): https://api.humae.com.mx/api/v1/health cada 5 min.
  • Better Uptime (alternativa).
  • Pingdom, StatusCake.

Alerta por email + SMS al admin si el health falla 2 checks seguidos.

Políticas de seguridad

Content Security Policy (CSP)

Recomendado agregar en el frontend (Next.js headers):

ts
// next.config.ts
const csp = [
  "default-src 'self'",
  "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://js.stripe.com",
  "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
  "font-src 'self' https://fonts.gstatic.com",
  "img-src 'self' data: https://api.humae.com.mx",
  "connect-src 'self' https://api.humae.com.mx https://api.stripe.com",
  "frame-src https://checkout.stripe.com",
].join('; ');

HSTS

Activar Strict-Transport-Security con max-age=31536000 (1 año). Una vez activo, no se puede volver atrás sin esperar el timeout, así que confirma primero que HTTPS funciona en todos los subdominios.

CAA records

Restringe qué CA puede emitir certs para tu dominio:

text
Type: CAA
Name: @
Value: 0 issue "letsencrypt.org"
Value: 0 issue "pki.goog"   # si usas Google/Cloudflare

Siguiente

Configuración del servidor y servicios internos: Infraestructura →

Manual de usuario HUMAE · Uso interno