HTTP Redirect

You cannot perform HTTP redirects in the DNS itself. A webserver is required for this. To simplify HTTP redirects, Ops One offers a redirect service. The service is free and takes care of the redirect. The only thing you have to do is create an A/AAAA and TXT record.

Specification

blog.example.org. IN A    185.169.84.4
blog.example.org. IN AAAA 2a04:503:0:1023::4
blog.example.org. IN TXT  v=opsone-redirect-v1;destination=https://example.org/;contact=john@example.com

Specification:

  • v (mandatory): Used for identification, currently only opsone-redirect-v1 is supported.

  • destination (mandatory): The URL to redirect to, only valid if protocol is http:// or https://.

  • contact (mandatory): Your email address. Required in case we need to contact you.

  • code (optional): The HTTP status code, default to 302.

How-To

  1. Add the TXT record for the (sub)domain you want to redirect. See the specification above.

  2. Add the A and AAAA records for the same (sub)domain.

  3. Wait for the DNS changes to propagate.

  4. Check if the redirect works.

Some browsers heavily cache redirects. If you have problems, try a different browser or clear the cache. The easiest way to check the redirect is to use command line tool like curl or wget.

Example:

$ curl --head https://blog.example.org
location: https://example.org/

SSL Certificate

The redirect service automatically uses a Let’s Encrypt certificate. The certificate is issued with the first request, which is why the first request takes a little longer to complete. If the certificate cannot be issued, you can check your (sub)domain for setup errors with letsdebug.net.

Known Errors

If you have been redirected here, you will find an error code in the address bar. Please check that the TXT record is correct and available. You can use dig or nslookup to check the TXT record.

Example:

$ dig blog.example.org txt
blog.example.org. 300 IN TXT "v=opsone-redirect-v1;destination=https://example.org/;contact=john@example.com"

In the DNS respose you also see the Time to Live (300 seconds in this case). You need to wait at least this time for the changes to propagate.

Error 42

No host header found.

Error 43

No txt record found.

Error 44

No txt record with string opsone-redirect-v1 found.

Error 45

More then one txt record with string opsone-redirect-v1 found.

Error 46

No destination found.

Error 47

No contact found.