INNER CODE UNIT · TypeScript

getPublicUrl

getwud/wud · app/configuration/index.ts:194

export function getPublicUrl(req: Request) {
    const publicUrl = wudEnvVars.WUD_PUBLIC_URL;
    // Try to guess from request if not explicitly configured
    const origin =
        publicUrl ?? `${req.protocol}://${req.headers.host ?? req.hostname}`;
    const basepath = getServerConfiguration().basepath;
    if (basepath === '/') {
        return origin.replace(/\/$/, '');
    }
    return `${origin.replace(/\/$/, '')}${basepath}`;
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…