acme.com/go/:slug) rather than dedicating a separate root domain (acme.link) or subdomain (go.acme.com).link.acme.com), terminating TLS directly at Cloudflare's edge PoP.acme.com/go/* from their own infrastructure (such as an AWS ALB, Nginx droplet, or Cloudflare Worker), an architectural dilemma arises:1[Visitor] ---> (TLS: acme.com) ---> [Customer Proxy] ---> (TLS: ?) ---> [Shaf Cloudflare Edge]
acme.com.https://cname.shaf.app, it must send a Server Name Indication (SNI) in the TLS ClientHello.acme.com as the SNI value, Cloudflare edge immediately rejects the handshake with SSL_ERROR_UNRECOGNIZED_NAME_ALERT because Shaf only holds SSL certificates for cname.shaf.app on that fallback origin.cname.shaf.app (via proxy_ssl_name cname.shaf.app).cname.shaf.app.X-Forwarded-Host header (e.g. acme.com).cname.shaf.app, while passing X-Forwarded-Host to Shaf's routing middleware.domain:subpaths:${hostname}: Stores a JSON array of all active subpaths registered under that host, sorted by descending prefix length (longest prefix match first).domain:lookup:${hostname}: Stores apex domain configuration when a full domain is also registered./go/promo -> Shaf extracts prefix /go and slug promo./promo and sends X-Forwarded-Prefix: /go -> Shaf matches prefix /go and slug promo./promo with only X-Shaf-Proxy-Secret -> Shaf correlates the secret token to the domain's subpath record.X-Forwarded-* headers, Shaf implements a defense-in-depth security model to eliminate spoofing, denial-of-service, and server-side request forgery (SSRF).X-Shaf-Proxy-Secret)cname.shaf.app with X-Forwarded-Host: victim-company.com, stealing link quota or injecting unauthorized redirects.1spt_live_4k8b1n9x2p7v5m0q
subpath_proxy domain must include this token in X-Shaf-Proxy-Secret.X-Forwarded-For.X-Forwarded-For headers and uses Cloudflare's verified CF-Connecting-IP.X-Forwarded-For only after successfully verifying X-Shaf-Proxy-Secret (event.context.isSubpathProxy === true).1https://${domain}${pathPrefix}/__shaf_probe
localhost, 127.0.0.1, ::1, and *.localhost.10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.169.254.169.254.shaf.app, dash.shaf.app, shaf.is, cname.shaf.app).redirect: 'manual' with a strict 5-second timeout, preventing redirect-based SSRF pivoting.https://acme.com/go without a link slug, Shaf's router recognizes this as a subpath root request (isSubpathRoot = true).rootRedirectUrl on the domain record and redirects to that target (e.g. https://acme.com/deals).https://acme.com), ensuring a seamless user experience.