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

MSAL Node - HttpClient Proxy Improvements #6987

Closed
wants to merge 6 commits into from

Conversation

Robbie-Microsoft
Copy link
Collaborator

Added customAgent to msal-node system options so custom http(s) agents can be used by the HttpClient. This allows devs to use agents created by third party libraries (useful for proxy support).

Added support for authenticated proxy.

NOTE: faq.md was automatically linted. The only change is on line 75.

@github-actions github-actions bot added documentation Related to documentation. msal-node Related to msal-node package labels Mar 27, 2024
@Robbie-Microsoft Robbie-Microsoft linked an issue Mar 27, 2024 that may be closed by this pull request
@@ -72,6 +78,7 @@ export class HttpClient implements INetworkModule {
this.proxyUrl,
HttpMethod.POST,
options,
this.customAgent as http.Agent,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the customer configured https.Agent? Should you not throw an exception with a good error message explaining how to configure these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some improvements to address this.

Take a look at this stack overflow post.

https.Agent internally calls and constructs with http.Agent

I interpret this as meaning either one can be used. Look at my improvements and let me know your thoughts.

@@ -80,6 +87,7 @@ export class HttpClient implements INetworkModule {
url,
HttpMethod.POST,
options,
this.customAgent as https.Agent,
Copy link
Member

@bgavrilMS bgavrilMS Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this work with MSI? Calls to MSI are done over http.

I don't expect anyone to define a proxy for calling MSI. That can be unsupported scenario.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My improvements should address this.

Copy link
Member

@bgavrilMS bgavrilMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is not unit testable, but please explain how you manually tested this?

@Robbie-Microsoft
Copy link
Collaborator Author

I understand this is not unit testable, but please explain how you manually tested this?

I'll be testing this shortly on my Windows laptop with Fiddler, to simulate a proxy. I'm also going to to ask the user who filed the linked issue to test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. msal-node Related to msal-node package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants