Scenario
- I have nodejs app is deployed on our infrastructure at work
- At some point in the login / auth process of my app, my app will make a POST request to
https://login.microsoftonline.com
for authenticating the user (remix-auth-microsoft library is the one making the POST request) - My POST request to
login.microsoft.com
fail because our servers at work are not allowed to make external calls to the internet, unless we make our requests through a proxy (lets call it: example-proxy.com)
Question
How would I intercept the HTTP POST call that the 3rd party library is making in my nodejs app and proxy that request to
example.proxy.com
. Essentially I wantlogin.microsoft.com
to think the POST request is coming fromexample-proxy.com
. Then I want the proxy server to return that data to my appAre there specific headers I need to pass to make this work?
Some pseudo code of what I'm trying to do:
someInterceptor.on(request, (request) => {
if(outgoingRequest === 'https://login.microsoftonline.com') {
// somehow re-write the request so login.microsoftonline.com thinks the POST is coming from example-proxy.com
}
})