node.js - 如何创建本地 https 代理
问题描述
我正在尝试制作一个我将在本地托管的 http 和 https 代理。服务器的目标是在我的浏览器中使用它。我将https://npmjs.com/http-proxy用于 HTTP 请求,代码如下:
app.use("/", (req, res) => {
logger.info(
"[HTTP] " +
chalk.blueBright(">> ") +
req.hostname +
chalk.grey(" : ") +
req.path +
chalk.grey(" : ") +
req.headers["user-agent"]
);
httpProxy.web(req, res, { target: req.url, hostRewrite: true });
});
当我跑步时效果很好curl -x localhost:7540 http://wtfismyip.com/headers
,但是当我跑步时curl -x localhost:7540 https://wtfismyip.com/headers
,我得到了curl: (56) Proxy CONNECT aborted
。
解决方案
推荐阅读
- arrays - 根据最长列vba的长度隐藏行
- php - 年龄计算 & 如果在里面,如果不工作 / php
- java - 如果同一个线程一次又一次地获取锁,那么 ReentrantLock 如何公平?
- python - 使用除法休息python索引超出界限的多个子图
- php - php jsonparsing错误浏览器上没有数据
- php - 当其他输入更改值时,Kartik Select2 加载 ajax
- python - strptime() 参数 1 必须是 str,而不是 Series 时间序列转换
- r - 如何将 lm() 应用于按因子拆分的数据集
- python - 带有多行标题 xls 文件的 Pandas read_csv
- asp.net-mvc - Ajax 表单发布后模型中的 ASP.NET MVC 刷新控件