Axios: Ignoring Proxy Config with React Native

Created on 27 Aug 2017  ·  3Comments  ·  Source: axios/axios

 Summary

When trying to fetch to server with proxy, it just ignores proxy setting and fetch to server.
This problem already mentioned in this issue (https://github.com/mzabriskie/axios/issues/672)
But closed for some reason. and still occurred now.
I am using latest versions of react-native, and axios.
Here is my code below.

let config = {
      proxy: {
        host: '127.0.0.1',
        port: 8118
      }
    }
    axios.get('https://api.ipify.org/', config)
    .then(function (response) {
      console.log("-----------");
      console.log(response.data);
      console.log("-----------");
    })

Output: _Original IP, not proxied one_

 Context

  • axios version: v0.16.2
  • Environment: node v.8.3.0, and react-native-cli 2.0.1

All 3 comments

Closing, see duplicate.

I am still having this issue with react-native 0.57.1 (Expo 32.0.0)

Anyone know an alternative to send http request with proxy in RN ?

@mrmarktyy Hey Mark how did you manage to solve it?
I'm trying to call a proxy server from react-native and unable to do so, any help would be really appreciated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

achingbrain picture achingbrain  ·  3Comments

ildella picture ildella  ·  3Comments

ghprod picture ghprod  ·  3Comments

reggi picture reggi  ·  3Comments

Shu-Ji picture Shu-Ji  ·  3Comments