不能修改url,只能修改请求头。
- Dominant language
- JavaScript
- Stars
- 7.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Plese fill the template when you reporting a new issue, thanks!
#### Which platform are you running AnyProxy
Windows
#### The version of the AnyProxy
4.0.6
#### Your expected behavior of AnyProxy
我在试图用anyproxy修改url地址。
用官方文档里的
···javascripty
beforeSendRequest(requestDetail) {
if (requestDetail.url.indexOf('https://httpbin.org/user-agent') === 0) {
const newRequestOptions = requestDetail.requestOptions;
requestDetail.protocol = 'http';
newRequestOptions.hostname = '127.0.0.1'
newRequestOptions.port = '8008';
newRequestOptions.path = '/index.html';
newRequestOptions.method = 'GET';
return requestDetail;
}
},
···
这一段代码修改不了。
然后自己是了类似这样的代码、
‘’‘javascript
*beforeSendRequest(requestDetail) {
var url = requestDetail.url;
if (requestDetail.url.indexOf('cats') >=0 ) {
console.log('visited cats, going to dogs....')
var newUrl = 'http://localhost/dogs';
var newOptions = Object.assign({}, requestDetail.requestOptions);
newOptions.path = '/dogs'
console.log(newOptions);
return {
url: newUrl,
requestOptions: newOptions
};
}
},
'''
还是修改不了。有时候成功,请求cat跳转到dog,有时候还是跳转到cat。
我真在做爬虫,有些url参数很复杂,需要去掉一笑参数。然后看结果。
#### The actual behavior of AnyProxy
Anyproxy 不能修改url地址。
#### The log of the error
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the documented beforeSendRequest(requestDetail) hook and comparing changes to requestDetail.url with changes to requestDetail.requestOptions. Reproduce the cats-to-dogs example on AnyProxy 4.0.6 under Windows, then verify that URL rewrites are applied consistently and that query-parameter removal works for complex URLs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100