'Next.JS Image caching with redirected url

I am trying to deal with cdn image that is given indirectly

For example, when I GET an image from the cdn url https://example.com/img/123, it gives https://example2.com/img/456 .

In this case, I found that Next <Image> isn't even loading.

enter image description here

How can I work around and is there a way to cache it as well?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source