All topics
Setting up
The network drive
Blogs and forums
Files and websites
Cameras and sensors
Your Address and HTTPS
The server gets a hostname of its own under nas2.dk
and a real, browser-trusted certificate, set up by itself the first time the
app runs with a connection. The devices that connect trust it as they trust
any website.
Set up by itself
The network drive needs none of this and works on names local to your network. The hostname is assigned the first time the app runs with a connection, and the certificate follows right after: about two minutes, most of it waiting for DNS. Settings → Hostname shows where the certificate stands while that happens, and afterwards, and lets you ask for a fresh one whenever you want.
The hostname
The server registers and is assigned a hostname such as dk7q2xm4bz5.nas2.dk.
Settings → Hostname lists it under Public, above the .local name the
device answers to on your own network. The public
name follows the server wherever it goes, as NAS Reborn keeps the DNS records
pointed at the current address of the device: its address on your home
network while the Serve tab is switched to LAN, and its public address once
it is switched to Internet and reachable. Links you share from the app use the
address picked on the Serve tab, which is the .local name in LAN mode until
you pick another, and this hostname after a switch to Internet.
The certificate
The certificate is a genuine Let's Encrypt certificate and the device does the work itself. It proves control of its hostname through a DNS challenge, orders the certificate and installs it. The private key is generated on the device and never leaves it, and renewal happens automatically well before expiry.
The app shows you where the certificate is in its lifecycle: validating through Let's Encrypt, active with its expiry date, or a legible error when something is wrong, such as DNS trouble, rate limits or no network.
Over that connection the server speaks HTTP/2 to any browser asking for it, so the images, stylesheets and scripts of a page all travel down one connection instead of queueing. HTTPS also lets low-latency camera feeds play at full speed, since the video player from Apple only accepts them over HTTPS.
Why the hostname is used even at home
Certificates from public authorities cannot be issued for .local names or
bare IP addresses, so those would normally produce browser warnings. The
nas2.dk hostname carries a valid certificate whichever way the Serve tab is
switched. In LAN mode it resolves to the local address of the device, and
in Internet mode to your public one, which a browser at home reaches as well
when your router passes connections to its own public address back inside
(NAT loopback). For networks where the
hostname cannot help, such as one without internet, the server can
also make its .local address trusted, described in
Trusted HTTPS on Your Own Network.
nas2.dk in the rebind-protection exceptions or switch the
DNS server of the network.Your own domain
With Pro the server also answers on names you own, as many as you like, such
as files.yourdomain.com or the bare yourdomain.com. In Settings →
Hostname choose Add Custom Domain… and create the record the domain's
screen shows at your DNS provider. The screen's DNS host row names the
company that runs your domain's DNS, found from its nameservers, and opens
its DNS settings in your browser. For a name like files.yourdomain.com
that is one CNAME record pointing at the device's nas2.dk hostname, which
the app keeps on the device's address, so the domain follows when the
address changes.
The switch on the same screen picks via nas2.dk for that CNAME or
Direct for A and AAAA records with the device's addresses, for a domain
that should keep working without the nas2.dk service. The bare yourdomain.com takes those, because the apex
of a zone cannot be a CNAME. The A record appears when your network has
a public IPv4 address, the AAAA record when the device has a global IPv6
address. The screen checks the records as you go, and with the CNAME it also
checks that the nas2.dk hostname holds the device's address. When it does
not and has not changed lately, the screen says the nas2.dk service may be
down and suggests Direct, which works without it. Asking for the
certificate before the domain points at your server brings up a warning
first, because a failed attempt counts against an hourly limit at
Let's Encrypt.
A new domain serves all folders, like the nas2.dk hostname. Pin it to a
folder under Serves on the domain's screen, or from the menu when you
touch and hold it in the list (right-click on a Mac), and it serves that
folder's website at its root: blog.yourdomain.com opens on the blog's front
page, and visitors who open the blog at the device's other names are sent
there. Deleting the folder leaves the domain pinned to the folder's name, and
a folder you make again with that name is served there.
The Domain row on the domain's screen renames it. A certificate covers one name, so the new name needs its own DNS records and certificate. To remove a domain, swipe its row in the list or choose Remove domain… from its menu or its screen.
The server obtains this certificate itself as well. Let's Encrypt
usually checks your domain by connecting to the server on port 443 at the
address your records lead to, and my backend plays no part in that check.
For it, and for visitors from outside, the server must be reachable from the
internet, and with the CNAME the Serve tab must be set to Internet, so the
nas2.dk hostname carries the public address.
When the internet does not reach the server, the domain's screen adds a
second CNAME record, for the certificate: from _acme-challenge under your
domain to the device's own _acme-challenge name under nas2.dk, where the
nas2.dk service puts Let's Encrypt's check value for each certificate.
You create it once. With it in place,
Let's Encrypt checks the domain over DNS through the nas2.dk service
instead of connecting to the server, so the certificate is issued and
renewed, for the bare yourdomain.com too, while the server is reachable
only at home.
A and AAAA records are yours to maintain. When your internet provider assigns
you a new public address, the nas2.dk hostname follows it automatically,
and so does every CNAME to it; address records you created do not. The app tracks how often your address actually
changes and tells you, before you commit to a domain,
whether this connection looks like a steady home for one. If the address
later changes under a running domain, it warns you with the new value to
paste at your DNS host.
All the names serve at once, and the server answers each connection with the
certificate for the name that connection asked for, so the nas2.dk hostname
keeps working, and keeps following the device, while your own domains serve.
The address picker on the Serve tab decides which of them the app shows and
hands out, and removing a domain leaves the hostname as it was.