next-image-export-optimizer icon indicating copy to clipboard operation
next-image-export-optimizer copied to clipboard

Adding custom options when fetching remote images

Open mmarseu opened this issue 11 months ago • 4 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.

mmarseu avatar Mar 09 '24 13:03 mmarseu

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.

Niels-IO avatar Apr 07 '24 08:04 Niels-IO

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

Niels-IO avatar Jun 09 '24 21:06 Niels-IO

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

mmarseu avatar Jun 10 '24 06:06 mmarseu

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

Niels-IO avatar Jun 10 '24 18:06 Niels-IO