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 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-slb

v1.0.1

Published

aliyun slb

Readme

node-slb

an expressjs middleware for aliyun slb

缘起

http://bbs.aliyun.com/read/188736.html?page=1

2)请问健康检查发的什么请求? head 还是 get? head请求。

安装

npm install --save node-slb

用法

var slb = require('node-slb');

var app = express();
app.user(slb);

测试

首先启动demo的服务

➜  node-slb git:(master) ✗ npm start

> [email protected] start /Users/sang/workspace/github/node-slb
> cd demo && npm install && npm start


> [email protected] start /Users/sang/workspace/github/node-slb/demo
> node ./bin/www

执行test命令,测试请求

➜  node-slb git:(master) ✗ npm test

> [email protected] test /Users/sang/workspace/github/node-slb
> curl -i -X HEAD http://127.0.0.1:3000

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/plain; charset=utf-8
Content-Length: 2
ETag: W/"2-d736d92d"
Date: Mon, 29 Jun 2015 03:46:49 GMT
Connection: keep-alive

此时,观察服务器日志

➜  node-slb git:(master) ✗ npm start

> [email protected] start /Users/sang/workspace/github/node-slb
> cd demo && npm install && npm start


> [email protected] start /Users/sang/workspace/github/node-slb/demo
> DEBUG=slb node ./bin/www

[ALIYUN.COM LOG]: SLB health checking....OK...

如果出现[ALIYUN.COM LOG]: SLB health checking....OK...说明正常。

如果想打印日志,可以DEBUG=slb,如果不想打印日志,默认即无。

科普:HEAD请求官方定义

HTTP请求方法并不是只有GET和POST,只是最常用的。据RFC2616标准(现行的HTTP/1.1)得知,通常有以下8种方法:OPTIONS、GET、HEAD、POST、PUT、DELETE、TRACE和CONNECT。

HEAD方法跟GET方法相同,只不过服务器响应时不会返回消息体。一个HEAD请求的响应中,HTTP头中包含的元信息应该和一个GET请求的响应消息相同。这种方法可以用来获取请求中隐含的元信息,而不用传输实体本身。也经常用来测试超链接的有效性、可用性和最近的修改。

一个HEAD请求的响应可被缓存,也就是说,响应中的信息可能用来更新之前缓存的实体。如果当前实体跟缓存实体的阈值不同(可通过Content-Length、Content-MD5、ETag或Last-Modified的变化来表明),那么这个缓存就被视为过期了。

简而言之 HEAD请求常常被忽略,但是能提供很多有用的信息,特别是在有限的速度和带宽下。

主要有以下特点:

  1. 只请求资源的首部;
  2. 检查超链接的有效性;
  3. 检查网页是否被修改;
  4. 多用于自动搜索机器人获取网页的标志信息,获取rss种子信息,或者传递安全认证信息等