For {httr2} you may also need to set ssl_verifyhost, hence
{httr2}
ssl_verifyhost
library(httr2) req <- request("https://example.com") |> req_options(ssl_verifypeer = 0) |> req_options(ssl_verifyhost = 0)