alibaba / alibaba/anyproxy

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

Open
#356 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

首先,我使用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没什么了解。希望路过的大佬可以帮忙看看
麻烦了

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Python requests call through AnyProxy on port 8888, then inspect the beforeSendRequest hook and its requestDetail/requestOptions changes. Compare the HTTPS request's expected proxy behavior with the rewritten HTTP forwarding configuration. Done means the request returns the expected ipapi.co response body, not only status code 200.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.