Next.js Discord

Discord Forum

Setting `protocol` on NextURL is sometimes ignored

Unanswered
McKay's Bunting posted this in #help-forum
Open in Discord
McKay's BuntingOP
  const updatedUrl: NextURL = request.nextUrl.clone();
  updatedUrl.protocol = "garbage:";
  console.log(updatedUrl);

I have middlewhere like the above. The protocol attribute does not get updated to garbage sometimes. I don't know why, but it is happening deterministically. It replaces it with https://. Is it because I have an https:// scheme in the URLContext?

0 Replies