Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
HRT是前端代理工具,根据配置把指定的URL指向到本地文件。
源代码安装
git clone git://github.com/tudouui/hrt.git
NPM安装
npm install hrt -g
修改浏览器代理设置,IP: 127.0.0.1
,端口: 2222
。
创建配置文件 ./config/my.js
,添加跳转规则。
指定单个文件。
var root = 'D:\\Projects\\static-trunk';
exports.map = [
['http://js.tudouui.com/js/lib/tuilib2.js', root + '/js/lib/tuilib2_combo.js']
];
把整个目录指向到本地。
var root = 'D:\\Projects\\static-trunk';
exports.map = [
['http://js.tudouui.com/js/lib', root + '/js/lib']
];
移除版本号。
exports.before = function(url) {
return url.replace(/([^?]+)_\d+(\.(?:js|css))/, '$1$2');
};
返回本地文件内容时,修改文件内容。
exports.merge = function(path, callback) {
// 所有JS头部添加注释
if (/\.js$/.test(path)) {
var content = Util.readFileSync(path, 'utf-8');
return callback('application/javascript', '/* test /*\n' + content);
}
// 其它请求
var contentType = require('mime').lookup(path);
var buffer = this.util.readFileSync(path);
return callback(contentType, buffer);
};
注:当配置文件里有 exports.merge
时会接管所有请求,所以在程序逻辑里需要加入文件类型判断。
在命令行输入 hrt
,启动HTTP服务。
hrt config/my.js
hrt config/my.js --port=8080
hrt config/my.js --debug=true
FAQs
HTTP Rewrite Tool
We found that hrt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.