microlinkhq / open

4 stars 2 forks source link

Attempt to fetch HTTPS version of url and media if available #17

Closed ValCanBuild closed 5 years ago

ValCanBuild commented 5 years ago

Feature Request

Is your feature request related to a problem? Please describe. It's always good practise to try and fetch https URLs. In my app I use microlink and both google and apple have started making it so http URLs do not load by default.

Describe the solution you'd like I'd like to be able to pass an option parameter to microlink, e.g. tryResolveHttps that will make it try to return https version of URLs (considering I've passed an http URL to it).

Describe alternatives you've considered An alternative to this would be doing it myself on my server but I think this would be a useful feature for Microlink to have.

Kikobeats commented 5 years ago

Hello,

I very aligned with your comment, however also I think is not the responsibility of the service try to fetch https version per each image detected.

When you pass an URL to microlink API, first it will detect the canonical URL and this URL will be used as base URL for creating absolute URLs to your relative URLs in your site.

This means that, if you pass https://microlink.io/home, then https://microlink.io/ will be the base URL. Then if in your site you have something like /logo.png, it will be resolved into https://microlink.io/logo.png.

So, to getting HTTPS urls, pass an HTTPS URL as first step 🙂

Also, If your site is HTTPS, then the markup can't contain non-HTTPS urls, so we can be sure all the images detected will be HTTPS.

I'm closing this because I think it's resolved but please feel free to comment