anyproxy 如何把https请求转发到http代理上

apeeds0o  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(77)

首先,我使用python代码是可以使用这个代理的
这个代理是ss,当然,我工作上用的是一些更复杂的代理

import requests

r = requests.get('https://ipapi.co/json/',
                 proxies={'all':'http://127.0.0.1:1080'},verify=False)
print(r.text)

然后我把代理调整为anyproxy,尝试让请求到anyproxy后再走代理

import requests

r = requests.get('https://ipapi.co/json/',
                 proxies={'all':'http://127.0.0.1:8888'},verify=False)
print(r.text)
print(r.status_code)
module.exports = {
    * beforeSendRequest(requestDetail) {
        const newRequestOptions = requestDetail.requestOptions;
        // 设置属性 rejectUnauthorized 为 false
        newRequestOptions.rejectUnauthorized = false;
        newRequestOptions.path = requestDetail.url;
        requestDetail.protocol = 'http';
        newRequestOptions.hostname = '127.0.0.1';
        newRequestOptions.port = '1080';
        return requestDetail;
    },
};

结果python这边返回的是

C:\Users\wplct\PycharmProjects\myProxy\venv\lib\site-packages\urllib3\connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)

200

没有返回值,我对nodejs没什么了解。希望路过的大佬可以帮忙看看
麻烦了

jpfvwuh4

jpfvwuh41#

这是response

{ hostname: '127.0.0.1',
  port: '1080',
  path: 'https://ipapi.co/json/',
  method: 'GET',
  headers:
   { Host: 'ipapi.co',
     Connection: 'keep-alive',
     'Accept-Encoding': 'gzip, deflate',
     Accept: '*/*',
     'User-Agent': 'python-requests/2.18.4' },
  rejectUnauthorized: false }
{ statusCode: 200,
  header: { 'x-anyproxy-origin-content-length': 0 },
  body: <Buffer >,
  rawBody: [] }

相关问题