Updated on 2024-02-28 GMT+08:00
Configuring Proxies for the SDK
If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference.
- In the root directory of the project, run the following command to download the proxy-agent dependency.
npm install --save proxy-agent
- Declare and configure proxies in the project.
const ProxyAgent = require("proxy-agent"); const proxyAgent = new ProxyAgent(`http://username:password@proxyhost:proxyPort`);
- Initialize an ObsClient instance and configure a proxy.
var obsClient = new ObsClient({ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways. Using hard coding may result in leakage. //Obtain an AK/SK pair on the management console. For details, see https://support.huaweicloud.com/intl/en-us/usermanual-ca/ca_01_0003.html. access_key_id: process.env.ACCESS_KEY_ID, secret_access_key: process.env.SECRET_ACCESS_KEY, security_token: process.env.SECURITY_TOKEN, server : 'https://your-endpoint', https_agent:proxyAgent, http_agent: proxyAgent, });
Parent topic: Initialization
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot