Readme

Insecure SSL Cert Fetch

This will be useful if you're getting a invalid peer certificate: UnknownIssuer error.

If you need to make a fetch request to a website with a dubious or non-standard SSL certificate, you can use this proxy we made on Cloudflare workers (which doesn't verify SSL certs): https://unsecure-fetch.val-town.workers.dev/

Create valimport { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch"; const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20"; const data = await insecureFetch(url) const text = await data.text(); console.log(text)
1
2
3
4
5
6
7
export function insecureFetch(input: string | URL | Request, init?: RequestInit) {
const origReq = new Request(input, init);
const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");
proxyURL.searchParams.set("url", origReq.url);
const req = new Request(proxyURL, origReq);
return globalThis.fetch(req);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.