Wildcard Image Domain on Next.js
yarn add @blazity/next-image-proxySave the following as pages/api/imageProxy.ts
ts
import { withImageProxy } from '@blazity/next-image-proxy'
export default withImageProxy({ whitelistedPatterns: [/^https?:\/\/(.*).mydomain.com/],})And use it as:
tsx
src={`/api/imageProxy?imageUrl=${actualImageUrl}`}