diff --git a/src/app.ts b/src/app.ts index d521695..7f21e4e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -91,7 +91,7 @@ AppDataSource.initialize().then(async () => { // Retrieve url, subdomain from request. let uri: string = req.url.slice(1); // discards / from /abc, /abc -> abc - let subdomain: string | null = req.headers.host!.replace(rs.fqdn, '') || null; + let subdomain: string | null = req.headers.host!.replace(rs.fqdn, '').slice(0, -1) || null; // slice() to remove trailing dot // Try to lookup the url in DB const reversedLink: Link | null = await linkService.lookupUriWithExpiryValidation(uri, subdomain);