Fetch with https all the time
Sometimes you want to fetch an insecure URL http://insecure-url.com/?example=1 from a secure server https://my-secure-server.com but you get this error:
Mixed Content: The page at 'https://my-secure-server/' was loaded over HTTPS,
but requested an insecure resource 'http://insecure-url.com/'.
This request has been blocked; the content must be served over HTTPS.
Fetch it with microsec!:
Deploy this microservice and run it with npm start. Let's say you're deployment is on this url: https://secure9000.pro.
// Javascript example
const fetch = require('isomorphic-fetch')
const url = 'https://secure9000.pro/insecure-url.com/?example=1'
fetch(url).then(/* MAGIC */)The headers you send inside the request will remain intact.
fetch(url, {headers: {'Accept-Language': 'es-ES,es;q=0.8,en;q=0.6,gl;q=0.4'}})| © 2017 Pablo Varela |
