Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 22.3.0 regression: undici sends invalid origin header in some cases #3334

Closed
mickdermack opened this issue Jun 17, 2024 · 2 comments · Fixed by #3335
Closed

Node 22.3.0 regression: undici sends invalid origin header in some cases #3334

mickdermack opened this issue Jun 17, 2024 · 2 comments · Fixed by #3335
Labels
bug Something isn't working

Comments

@mickdermack
Copy link

Bug Description

Since v6.16.1, undici sends the origin header as origin: https://origin.example.com, undefined in some cases.

This reproducibly happens when sending a POST request, with the origin header explicitly specified in headers and redirect: "error".

Reproducible By

import { fetch } from 'undici';

async function repro() {
  let api_url = "http://localhost:8080";
  let response = await fetch(api_url, {
    "headers": {        
      "origin": "https://origin.example.com"            
    },
    "body": "",    
    "method": "POST",
    "redirect": "error"
  });
}

await repro();

Expected Behavior

I expected the origin header to be sent as origin: https://origin.example.com.

Logs & Screenshots

complete request sent with undici v6.16.1 and above:

POST / HTTP/1.1
host: localhost:8080
connection: keep-alive
origin: https://origin.example.com, undefined
content-type: text/plain;charset=UTF-8
accept: */*
accept-language: *
sec-fetch-mode: cors
user-agent: undici
accept-encoding: gzip, deflate
content-length: 0

complete request sent with undici v6.16.0:

POST / HTTP/1.1
host: localhost:8080
connection: keep-alive
origin: https://origin.example.com
content-type: text/plain;charset=UTF-8
accept: */*
accept-language: *
sec-fetch-mode: cors
user-agent: undici
accept-encoding: gzip, deflate
content-length: 0

Environment

Arch Linux, Node.js v22.3.0

Additional context

@mickdermack mickdermack added the bug Something isn't working label Jun 17, 2024
@ronag
Copy link
Member

ronag commented Jun 17, 2024

@KhafraDev

@KhafraDev
Copy link
Member

Caused by 0a66d30, will fix soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants