Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: trustProxy for Fastify

Andras Bacsai792d51d93f3f
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 362049263f..793504c900 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -26,7 +26,8 @@ declare module 'fastify' {
const port = isDev ? 3001 : 3000;
const host = '0.0.0.0';
const fastify = Fastify({
- logger: false
+ logger: false,
+ trustProxy: true
});
const schema = {
type: 'object',
diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts
index a9a7da877f..58868e5996 100644
--- a/apps/api/src/lib/common.ts
+++ b/apps/api/src/lib/common.ts
@@ -202,6 +202,7 @@ export async function checkDomainsIsValidInDNS({ hostname, fqdn, dualCerts }): P
const domainDualCert = domain.includes('www.') ? domain.replace('www.', '') : `www.${domain}`;
dns.setServers(['1.1.1.1', '8.8.8.8']);
let resolves = [];
+ console.log(hostname)
try {
if (isIP(hostname)) {
resolves = [hostname];
@@ -209,7 +210,7 @@ export async function checkDomainsIsValidInDNS({ hostname, fqdn, dualCerts }): P
resolves = await dns.resolve4(hostname);
}
} catch (error) {
- throw { status: 500, message: `DNS not set correctly or propogated.<br>Please check your DNS settings.` }
+ throw { status: 500, message: `Could not determine IP address for ${hostname}.` }
}
if (dualCerts) {