This module return the real custom host when you are using AWS Amplify with custom domains on Next JS using Server Side Rendering.
import rocketUrl from 'rocket-url'
App.getInitialProps = async ({ ctx }) => { const { host, protocol, origin } = rocketUrl(ctx?.req)
return {
props: {
host,
protocol,
origin
}
}
}
export async function getServerSideProps({ req, resolvedUrl }) { const { host, protocol, origin } = rocketUrl(req) const pathname = resolvedUrl
return {
props: {
host,
protocol,
origin,
pathname
}
}
}