link-preview-js icon indicating copy to clipboard operation
link-preview-js copied to clipboard

Follow multiple redirects (maybe with a configurable max)

Open wouterlemcke opened this issue 2 years ago • 4 comments

It would be great if we could make the library follow multiple redirects. The issue we're encountering is that we try to generate a preview for a link that has 2 redirects on it First from HTTP to HTTPS and then a 'normal' redirect to another path.

Unfortunately we don't control the source of this link, so we cannot change it.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

wouterlemcke avatar Sep 08 '22 08:09 wouterlemcke

PRs are welcome

ospfranco avatar Sep 08 '22 09:09 ospfranco

Maybe is possible if you set followRedirects: 'manual' and then in handleRedirects you count the number of redirects, When your desired maximum redirects is reached, it should return a reject,

I haven't tested this yet, but it makes sense. I didn't had a way to test.

george-i avatar Sep 15 '22 09:09 george-i

@george-i It seems like the library only allows 1 redirect to happen.

edymusajev avatar Feb 24 '23 03:02 edymusajev

Back from a long vacation, looks like some of you are using the library in a paid product, would gladly implement this for you guys for a small fee/sponsorship.

ospfranco avatar Aug 16 '23 07:08 ospfranco