Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

axios - Proxy network requests via React Native

I am building a React Native app using Expo. The app sends some network requests via axios, i am trying to send these requests through a proxy but it seems my IP is still the originating source.

Here is my sample code:

(async () => {
  const res = await axios.get("https://api.ipify.org?format=json", {
    proxy: {
      host: "gb.smartproxy.com",
      port: "440066",
      auth: {
        username: "user",
        password: "password"
      }
    }
  });

  console.log(res.data);
})();

I have tried with fetch() and also https-proxy-agent however neither seem to work.

Is there a way i can send network requests using React Native through a proxy?

question from:https://stackoverflow.com/questions/65909020/proxy-network-requests-via-react-native

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...