Documentation

Everything AFWD does is configured in your DNS. The setup tool builds the records for you; this page explains every option.

DNS setup

You add two things at your DNS provider: a record that points your domain at AFWD, and a TXT record that says where to forward to. Replace example.com with your domain.

Subdomain: CNAME

For a subdomain such as go.example.com, add a CNAME to fwd.afwd.nl. A name with a CNAME cannot have other records, so the TXT record goes on _afwd.go.example.com:

go.example.com.       14400 CNAME fwd.afwd.nl.
_afwd.go.example.com. 14400 TXT   "v=afwd1 dest=https://www.example.net/"

Root domain: ALIAS, ANAME or CNAME flattening

A root domain such as example.com cannot have a normal CNAME. Many DNS providers offer a record that works like one: ALIAS, ANAME, or a CNAME on the root domain that they flatten (Cloudflare does this automatically). Point it at fwd.afwd.nl:

example.com.       14400 ALIAS fwd.afwd.nl.
_afwd.example.com. 14400 TXT   "v=afwd1 dest=https://www.example.net/"

With a CNAME or ALIAS, your domain follows AFWD automatically. If AFWD moves to new addresses, you don't have to change anything.

Any DNS provider: A and AAAA records

If your DNS provider does not support ALIAS, ANAME or CNAME flattening, add these A and AAAA records with the TXT record on the domain itself:

example.com. 14400 A     178.104.1.215
example.com. 14400 AAAA  2a01:4f8:1c16:9c3c::1
example.com. 14400 TXT   "v=afwd1 dest=https://www.example.net/"

These addresses are fixed in your DNS. If AFWD ever moves to new addresses, you have to update these records.

All subdomains

To forward all subdomains with the same configuration, add this wildcard CNAME record:

*.example.com. 14400 CNAME example.com.

Where AFWD looks for the TXT record

For a request to www.example.com, AFWD uses the first v=afwd1 TXT record it finds at:

  1. _afwd.www.example.com
  2. www.example.com itself, as in the afwd1 specification. If the name is a CNAME, this is the record of the name it points to.
  3. If www.example.com is a CNAME to example.com: _afwd.example.com, then example.com.

The _afwd. name is an AFWD extension of the afwd1 specification. It is what makes CNAME setups possible.

SSL/TLS certificates are provided automatically for HTTPS. Certificates renew automatically while your DNS records remain active.

TXT options

OptionValuesDefaultMeaning
destHTTP or HTTPS URLrequiredForwarding destination.
preservey or nnKeep the source path and query string: /blog/post?x=1 is added to the destination.
appendy or nnAppend the source domain to dest before any fragment. Include any prefix, such as ?domain=, in dest.
type301, 302, 307, 308, perm, temp302HTTP redirect status.
certnoenabledPrevent automatic HTTPS certificate issuance.

Examples

v=afwd1 dest=https://example.net/
v=afwd1 preserve=y type=308 dest=https://example.net/
v=afwd1 type=perm append=y dest=https://example.net/?domain=

Redirect status codes

The type option controls the HTTP response. The default is 302.

CodeNameUse it when
301 or permMoved PermanentlyThe destination will not change. Browsers and search engines can cache this redirect.
302 or tempFoundThe destination can change. This is the default and is suitable for most forwarding rules.
307Temporary RedirectThe destination can change and the client must keep the original HTTP method and request body.
308Permanent RedirectThe destination will not change and the client must keep the original HTTP method and request body.

Use 307 or 308 when forwarding requests such as POST. Some clients can change POST requests to GET with 301 or 302.

HTTPS

SSL/TLS certificates are provided automatically when you use HTTPS. Visit your domain after DNS changes so certificate setup can start.

Statistics

The service counts the requests to your domain: hits per hour and status, paths, and referrer domains. It does not store IP addresses, user agents, or query strings. Statistics are kept for 90 days.

See the 100 most active domains across the service.

To see the statistics for your domain:

  1. Open the statistics page and click Create token. Your browser creates the token. Keep the token secret.
  2. Add the TXT record that the page shows. It contains the SHA-256 hash of the token, not the token:
    _afwd-stats.example.com. 3600 TXT "v=afwdstats1 h=<sha256 hex of token>"
  3. Click Show. The page stores the token in your browser, so next time you only enter your domain.

To give access to more tokens, add more h= records. To remove access, delete the record.

This service is based on the specifications defined by afwd.uk.