Created
February 3, 2020 08:06
-
-
Save banyudu/bd8b2ad63eb0b187cb64b9df664ef90e to your computer and use it in GitHub Desktop.
setup axios proxy with shadowsocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // change host / port / protocol to your real values | |
| const axiosOptions: AxiosRequestConfig = {} | |
| const httpsAgent = new SocksProxyAgent({ | |
| host: '127.0.0.1', | |
| port: 1086, | |
| protocol: 'socks5:', | |
| rejectUnauthorized: false | |
| }) | |
| axiosOptions.httpAgent = httpsAgent | |
| axiosOptions.httpsAgent = httpsAgent | |
| axiosOptions.proxy = false | |
| process.env.NODE_TLS_REJECT_UNAUTHORIZED = null // dangerous, do not use in production. | |
| export const rest = axios.create(axiosOptions) | |
| // rest.get('https://google.com') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment