npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

curl-proxy

v0.0.8

Published

解决代理转发post请求失败

Downloads

3

Readme

curl-proxy

解决代理转发post请求失败 (0.0.7测试版,本地需支持curl命令)

###版本说明

0.0.5: 修复返回实际statusCode bug

0.0.6: 增加测试

概述:

1.在前后端分离情况下使用http-proxy做请求转发非get请求失败

2.目前所有代理模块都存在这一问题,所以换一个思路:使用curl做请求,最后将得到的数据用原生res.white回去即可

1.开始:

```
npm install curl-proxy
```

2.引入调用:

```
var curlProxy = require('curl-proxy');
// 如果node webserver没有设置必须先设置
curlProxy.lodashHeaders(this, {
    host: '10.95.105.135:8030',
    protocol: 'http' // 默认http,可不用设置
});
curlProxy.request(this);
// 传入this是原生node websever对象
```

###关于windows不支持curl解决方案:

1.下载curl工具

2.下载完成后将curl文件夹放在d:\盘下;

3.右键单击“我的电脑”——“属性”——“高级”——“环境变量”——“系统变量”——“Path”——“编辑”——加入“;D:\curl;”(注意分号); D:\curl换成你的curl路径也可以)——“确定”加入到系统环境变量后可在命令提示符内直接运行

4.测试:

	```
	curl -I http://www.163.com
	
	出现:
	HTTP/1.1 200 OK
	Date: Sat, 22 Oct 2016 06:25:01 GMT
	Server: openresty
	Content-Type: text/html; charset=GBK
	Vary: Accept-Encoding,User-Agent,Accept
	Expires: Sat, 22 Oct 2016 06:26:21 GMT
	Cache-Control: max-age=80
	X-Via: 1.1 hbtj81:0 (Cdn Cache Server V2.0), 1.1 		chd33:6 (Cdn Cache Server V2.0), 1.1 bjdxtck20:2 		(Cdn Cache Server V2.0)
	Connection: keep-alive
	及说明现在已经支持curl命令了,可以使用本工具发起请求代理了
	```
	

5.如果想要支持https那么就需要安装ssl版本的了,请按照以下方案:

~~1).下载curl-ssl工具

~~2).下载完成后将curl文件夹放在d:\盘下;

~~3).右键单击“我的电脑”——“属性”——“高级”——“环境变量”——“系统变量”——“Path”——“编辑”——加入“;D:\curl;”(注意分号); D:\curl换成你的curl路径也可以)—

~~4).“确定”加入到系统环境变量后,将文件夹中的【Win32OpenSSL_Light-1_1_0b.exe】安装;

~~5).在命令提示符内直接运行

	```
	curl -I -k https://www.baidu.com
	
	如果出现:
	HTTP/1.1 200 OK
	Server: bfe/1.0.8.18
	Date: Sat, 22 Oct 2016 06:53:58 GMT
	Content-Type: text/html
	Content-Length: 277
	Connection: keep-alive
	Last-Modified: Mon, 13 Jun 2016 02:50:53 GMT
	ETag: "575e1f8d-115"
	Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
	Pragma: no-cache
	Accept-Ranges: bytes
	及说明现在已经支持curl发起https命令了,可以使用本工具发起请求代理了

	```
	

6.如果是win_64系统请下curl-ssl_64

7.注意,如果失效可能是:需要安装这个,windows下,命令行启动后会自动新开一个命令行,关闭即可。

安装 Visual C++ 2008 Redistributable Package

安装 Visual C++ 2010 Redistributable Package