Skip to content

issue in docs about fetching urls with bad SSL certs #506

@duckness

Description

@duckness

Describe the change

Image

The readme suggest using ProxyAgent to bypass SSL errors. However, this is not possible since uri is required in ProxyAgent. Instead, use undici's Agent.

Image

import { Agent } from "undici";
import { ofetch } from "ofetch";

//// Note: This makes fetch unsecure against MITM attacks. USE AT YOUR OWN RISK!
const unsecureAgent = new Agent({ connect: { rejectUnauthorized: false } });
const unsecureFetch = ofetch.create({ dispatcher: unsecureAgent });

const data = await unsecureFetch("https://self-signed.badssl.com");

URLs

https://github.com/unjs/ofetch?tab=readme-ov-file#%EF%B8%8F-adding-https-agent

Additional information

  • Would you be willing to help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions