Skip to content

Commit

Permalink
fix: make app domain answer authoritative.
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Nov 5, 2024
1 parent e4b9e1d commit 3216eb8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib/dns/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ export async function startDnsServer() {
// the NS ( nameserver ) records associated to our public domain.
const appDomain = pubenv.PUBLIC_DOMAIN.split(':')[0];

// Set all answers to authoritative by default
s.use(async (_req, res, next) => {
if (res.finished) return next();

res.packet.flags = res.packet.flags | AUTHORITATIVE_ANSWER;
next();
});

// Now we can add an A record that will direct web traffic to the app
staticRecords.set(appDomain, 'A', APP_IPS);
s.use(staticRecords.handler);
Expand All @@ -77,14 +85,6 @@ export async function startDnsServer() {
}
});

// Set all answers to authoritative by default
s.use(async (_req, res, next) => {
if (res.finished) return next();

res.packet.flags = res.packet.flags | AUTHORITATIVE_ANSWER;
next();
});

// Return SOA responses
s.use(async (req, res, next) => {
if (res.finished) return next();
Expand Down

0 comments on commit 3216eb8

Please sign in to comment.