Skip to content

Using Subdomain Manager

What the administrator sees

Open Subdomain Manager in the admin sidebar.

  • Global Settings and Add New Domain are described in Configuration.
  • Configured Domains lists every domain with its ID, name and zone ID, and a pencil and a trash button. The ID is the domain_id used by the application API.
  • Active Subdomain Allocations lists every subdomain that belongs to an existing server: its ID, the full name, the server (linked to the server's admin page) and the ID of its allocation.

The admin page has no button to create, change or delete a single subdomain. Use the server's Subdomains tab or the application API for that.

What the server owner sees

Every server gets a Subdomains tab in its navigation, next to Files. It is visible to the owner and to subusers with the permission subdomains.read. The tab is shown for all servers, also for eggs that have no domain.

The page lists the server's subdomains. Each row shows the full name (a click copies it), how long ago it was created, an Update button and a delete button. The list reloads every 10 seconds.

Below the list:

  • "There are no subdomains currently configured for this server." if the list is empty.
  • "2 of 5 subdomains have been created for this server." once at least one exists.
  • The Create Subdomain button, as long as the server is below the limit. The button is greyed out if no domain is enabled for the server's egg.
  • "Subdomains cannot be created for this server because the subdomain limit is set to 0." if the limit is 0.

Create a subdomain

  1. Click Create Subdomain.
  2. Enter a name under Subdomain. It must have 3 to 32 characters.
  3. Choose a Domain. Only domains enabled for the server's egg are listed.
  4. Choose an Allocation. The server's default allocation is preselected. Additional allocations are listed under Additional.
  5. Click Create Subdomain.

The panel then:

  1. checks that the domain is enabled for the server's egg,
  2. checks that the server is below Max Subdomains Per Server,
  3. checks the name against the Word Blacklist,
  4. checks that the allocation belongs to the server,
  5. stores the subdomain and sends the domain's record template to Cloudflare.

If Cloudflare rejects the request, the subdomain is not stored. A name can be used once per domain.

Warning

The name is only checked for its length, the blacklist and uniqueness. The addon does not check which characters it contains. If Cloudflare refuses the name, the user sees "This subdomain is already in use."

Change the allocation

Update opens a dialog in which only the Allocation can be changed. Name and domain are fixed. On Update Subdomain the addon sends one batch request to Cloudflare that deletes the subdomain's existing records and creates new ones from the domain's current template with the new allocation's address and port.

If an allocation was removed from the server after the subdomain was created, the dialog shows Unknown as the current allocation. The DNS records keep pointing to the old address and port until the user chooses a new allocation or deletes the subdomain.

Delete a subdomain

The delete button asks "Are you sure you want to delete this subdomain? This action cannot be undone." After Delete, the records are removed from Cloudflare and the subdomain disappears from the list.

Rate limit and activity log

Creating, updating and deleting are limited to five requests per minute by the routes you added during installation.

Each successful action in the tab is written to the server's activity log as server:subdomain.create, server:subdomain.update or server:subdomain.delete, with the subdomain, the domain and the allocation.

Which DNS records are created

The addon does not decide by itself which records a server gets. It sends the record template of the chosen domain, and each domain is tied to eggs. So the records depend on the domain, and you control per egg which domains are available.

With the default template, every subdomain gets two records, whatever the egg is:

Type Name Content TTL
A <name>.<domain> The IPv4 address of the allocation. If the allocation has an IP alias, the address that the alias resolves to. Not proxied by Cloudflare. 120
SRV _minecraft._tcp.<name>.<domain> Priority 0, weight 5, the allocation's port, target <name>.<domain> 120

The _minecraft._tcp SRV record is the one Minecraft: Java Edition clients look up, so players can connect with <name>.<domain> without a port. For other games, edit the template of a separate domain as described in Configuration.

Every record carries the comment subdomainmanager.subdomain_id=<ID>. You can see it in the Cloudflare dashboard. The addon uses it to find the records again.

When DNS records are removed

In every case the addon asks Cloudflare for all records in the zone whose comment is subdomainmanager.subdomain_id=<ID> and deletes exactly those. Records you created yourself in the same zone are not touched.

Event What happens
A user deletes a subdomain in the Subdomains tab The records are deleted at Cloudflare immediately, then the subdomain is deleted in the panel. If the Cloudflare call fails, the subdomain stays in the list and the user sees "Failed to delete subdomain."
A subdomain is deleted through the application API Same as above.
A server is deleted The line you added to ServerDeletionService.php queues DeleteSubdomainsJob with all subdomains of the server. The job deletes the records at Cloudflare and then the subdomains in the panel.
A domain is deleted in the admin area DeleteSubdomainsJob is queued with all subdomains of the domain. After their records and rows are deleted, the domain itself is deleted.
An allocation is removed from a server Nothing. The records stay until the subdomain is updated or deleted.

Details of the queued job:

  • It runs on the panel's queue, so the queue worker must be running. Until the job has run, the records still exist at Cloudflare.
  • At the end of every run it also cleans up leftovers: subdomains whose server no longer exists. Their Cloudflare records and rows are deleted too. This covers servers that were deleted without the job being queued.
  • If a Cloudflare call fails during the job, the job stops with an error. Subdomains that were not processed stay in the database, and the domain is not deleted. Leftovers of deleted servers are picked up by the next run of the job, which is the next time a server or a domain is deleted.

Warning

Subdomains of a deleted server are not shown in Active Subdomain Allocations. While such a subdomain is waiting for clean-up, its name stays taken on that domain.

Application API

The routes you added to routes/api-application.php are meant for billing systems. They need an application API key of the panel, sent as Authorization: Bearer <key>. The controller does not check a specific permission of the key. {server_id} is the numeric server ID, not the UUID.

Method and path What it does
GET /api/application/subdomainmanager/domains Lists all configured domains with id and domain.
GET /api/application/subdomainmanager/servers/{server_id}/subdomains/check?subdomain=play&domain_id=1 Returns available (true or false) and a message. A name is unavailable if it is on the blacklist or already exists on that domain. The length is not checked here. An unknown domain_id returns 404.
POST /api/application/subdomainmanager/servers/{server_id}/subdomains Creates a subdomain. Body: domain_id, allocation_id, subdomain (3 to 32 characters). Returns 201 with id, server_id, domain_id, allocation_id, subdomain, full_domain, port and record_type.
DELETE /api/application/subdomainmanager/servers/{server_id}/subdomains/{record_id} Deletes the Cloudflare records and the subdomain. Returns 204.

Example body for creating a subdomain:

{
  "domain_id": 1,
  "allocation_id": 7,
  "subdomain": "play"
}

Differences from the Subdomains tab:

  • The API does not check whether the domain is enabled for the server's egg. Any configured domain can be used.
  • The blacklist and Max Subdomains Per Server apply. Both return status 400.
  • The allocation must belong to the server, otherwise the API returns 404.
  • record_type in the response is always A+SRV, also if you changed the domain's template.
  • Nothing is written to the activity log.

Warning

If Cloudflare rejects the records, the API returns status 500 with the Cloudflare error, but the subdomain stays stored in the panel without DNS records. It counts towards the limit and blocks the name. Delete it with the DELETE endpoint, using the ID shown in Active Subdomain Allocations.

The panel's own Subdomains tab uses the client API under /api/client/servers/{server_uuid}/subdomainmanager (GET /, POST /, PATCH /{id}, DELETE /{id}). POST takes subdomain, domain and allocation, PATCH takes allocation.