Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding custom options when fetching remote images

mmarseu opened this issue · comments

Could you add a way to add custom option to the HTTP requests made when downloading remote images?

I have some images hosted on internal servers. To fetch these, custom headers must be set.
As far as I can tell, there is no way to provide these headers - apart from monkeypatching shenanigans.

I figure the most versatile implementation would be to enable remoteOptimizedImages.js to return these options with each URL, since they might not be the same for all remote images.

Hi @mmarseu,

Let me think about this. In general, the remote image feature needs more work and I will have a look how this could be implemented.

commented

I just enabled the functionality of query params in remote images. Would that be enough for your use case?

It's always great to see progress but unfortunately no. In my case, I really need to set custom headers for the image request.

commented

Hi @mmarseu,

I created a PR with a proposal for this functionality: #223

If you have time, you could check it out and give your feedback.

Thanks,
Niels