Skip to content

Hostname/IP does not match certificate's altnames #1678

Answered by tbontb-iaq
tbontb-iaq asked this question in Q&A
Discussion options

You must be logged in to vote

Forgive my stupid question. Remove the host field and referer field before sending the request header.

import express from "express";
import fetch from "node-fetch";

const app = express();

app.get("/api/get", (req, res) => {
  const url = req.query["url"];
  delete req.headers.host;
  delete req.headers.referer;
  if (typeof url === "string")
    fetch(url, {
      headers: req.headers as Record<string, string>,
    })
      .then((r) => {
        // do something
      })
      .catch((e) => {
        // do something
      });
  else {
    // do something
  }
});

export const handler = app;

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@marian-gheorghe
Comment options

@marian-gheorghe
Comment options

@victors1681
Comment options

@tbontb-iaq
Comment options

@ahmdadl
Comment options

Answer selected by tbontb-iaq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants