You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can do it by utilizing the underlying HTTP agent in Node.js:
constagent=newhttp.Agent({localAddress: '192.168.1.100'});// Replace with your desired local addressconstoptions={};options.httpAgent=agent;returnaxios.post(url,location,options).then((result)=>{})
What I typically do is create a configurable Axios client using a factory function. Here is an example, where the fallback is a local address. Setting the environment variable HTTP_REQUEST_ADDRESS can alter where HTTP requests are made.
Describe the issue
I need to set my local address to be used on my request.
Is there some way to do it?
PS: I already check axios requests documentation and I know the option localAddress is not listed there.
Example Code
Expected behavior
I would expect to be able set my local address on HTTP requests.
Axios Version
1.6.8
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
16.20.2
OS
No response
Additional Library Versions
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: