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

fix: allow specifying the user-agent header for outgoing requests #1287

Merged

Conversation

pvieira-diligent
Copy link
Contributor

Specifying the user-agent header for outgoing requests was introduced in 95f24ef.

This PR is fixing an issue with that commit: the user-agent header value set in the httpOptions config is not really being used, and the http agent defaults to not sending the user-agent HTTP header.

  const helperOptions = pickBy({ signal, agent, dnsLookup }, Boolean);
  // ...
  options.headers['user-agent'] = helperOptions['user-agent']; // at this point, helperOptions['user-agent'] is always undefined

In practice, due to the missing user-agent, WAFs could block requests to the jwks_uri endpoint during a client authentication.

@panva
Copy link
Owner

panva commented Jan 17, 2025

Clearly i should've added a test then, apologies. Can you add a test now?

@pvieira-diligent
Copy link
Contributor Author

Clearly i should've added a test then, apologies. Can you add a test now?

I've added a couple of tests already.

Are you expecting different ones? I'm happy to add more if I'm missing any scenarios.

@panva panva merged commit c77513c into panva:main Jan 19, 2025
46 checks passed
@panva
Copy link
Owner

panva commented Jan 19, 2025

Thank you @pvieira-diligent

@pvieira-diligent pvieira-diligent deleted the fix-http-options-user-agent-override branch January 20, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants