SA
메인 내용으로 이동

Wildcard Image Domain on Next.js

yarn add @blazity/next-image-proxy

Save the following as pages/api/imageProxy.ts

import { withImageProxy } from '@blazity/next-image-proxy'

export default withImageProxy({
whitelistedPatterns: [/^https?:\/\/(.*).mydomain.com/],
})

And use it as:

src={`/api/imageProxy?imageUrl=${actualImageUrl}`}

이 문서를 언급한 문서들