@@ -14,6 +14,7 @@ interface WhitelabelingDocumentProps {
1414 ogImageUrl : string | null ;
1515 faviconHref : string | null ;
1616 customCss : string | null ;
17+ baseUrl : string ;
1718}
1819
1920export default function Document ( {
@@ -22,11 +23,16 @@ export default function Document({
2223 ogImageUrl,
2324 faviconHref,
2425 customCss,
26+ baseUrl,
2527} : WhitelabelingDocumentProps ) {
2628 const title = appName || "Dokploy" ;
2729 const description =
2830 appDescription || "The Open Source alternative to Netlify, Vercel, Heroku." ;
29- const ogImage = ogImageUrl || "/og.png" ;
31+
32+ let ogImage = ogImageUrl || "/og.png" ;
33+ if ( ogImage . startsWith ( "/" ) ) {
34+ ogImage = `${ baseUrl } ${ ogImage } ` ;
35+ }
3036
3137 return (
3238 < Html lang = "en" className = "font-sans" >
@@ -80,6 +86,10 @@ Document.getInitialProps = async (
8086 let faviconHref : string | null = null ;
8187 let customCss : string | null = null ;
8288
89+ const host = ctx . req ?. headers ?. host || "localhost:3000" ;
90+ const protocol = ctx . req ?. headers ?. [ "x-forwarded-proto" ] || "http" ;
91+ const baseUrl = `${ protocol } ://${ host } ` ;
92+
8393 if (
8494 globalThis . __SETTINGS_CACHE &&
8595 globalThis . __SETTINGS_CACHE . expiresAt > Date . now ( ) &&
@@ -88,6 +98,7 @@ Document.getInitialProps = async (
8898 return {
8999 ...initialProps ,
90100 ...globalThis . __SETTINGS_CACHE . data ,
101+ baseUrl,
91102 } ;
92103 }
93104
@@ -125,5 +136,6 @@ Document.getInitialProps = async (
125136 ogImageUrl,
126137 faviconHref,
127138 customCss,
139+ baseUrl,
128140 } ;
129141} ;
0 commit comments