I have implemented an application using the Next.js framework. Within the application, there is a route handler that calls another independent API. I would like to inspect both requests (the one to the route handler and the second one from the route handler to the independent API) using a network traffic interception tool like Fiddler.
Unfortunately, I can only see the first request in the network traffic tool. I have attempted to set the http_proxy and https_proxy variables using the following command:
cross-env http_proxy=http://127.0.0.1:8888 https_proxy=http://127.0.0.1:8888 NODE_TLS_REJECT_UNAUTHORIZED=0 next dev
However, this setup doesn't seem to intercept the second request to the independent API. I am specifically looking for a solution that allows me to configure this at a global level for the entire application, not just for a single request.
I would appreciate any guidance on how to configure the environment or any other suggestions to capture both requests in Fiddler or some kind different tool.
I guess, that the second request is sent from the server side. That's why you see the first one, because it sends from your client (browser, postman and so on) to your server, the second one is sent from the function that you have implemented.
Without a context of execution, I can suggest you to look at your
server.jsfile and manipulate with the global handler (app.getRequestHandler();) from the Next.js library to intercept these requests.There is an example for you https://stackoverflow.com/a/60925269/22971299