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

http-proxy-404

v0.2.4

Published

<div align="center"> <h1>http-proxy-404</h1> <p>just proxy serve,proxy 404 interface to target servers</p> </div>

Readme

http-proxy-404mock 是一个基于http-proxy-middleware 开发的node代理服务器

Http-proxy-404 is a node proxy server based on http-proxy-middleware

你可以用它做什么呢?

What can you do with it?

你可以配置一堆不同环境的接口服务地址

You can configure a bunch of interface service addresses for different environments.

它会自动嗅探接口在当前配置的服务器地址中 请求的response的状态是否为404,如果请求的状态是404,它会往下一个地址中继续请求,直至成功

It will automatically sniff the interface to request the response status in the currently configured server address is 404,If the status of the request is 404, it will continue the request to the next address until it succeeds

$ npm install http-proxy-404 --save-dev

or

$ yarn add http-proxy-404 -D

step1: create serve.js

const Proxy404 = require('http-proxy-404')

new Proxy404({
  port: 8081,
  apiReg: '/api*',
  targetList: [
    'target host1',
    'target host2',
    'target host3'
  ],
  '404func': function(res) {
    if(!res.response) {
      return true
    }
  }
})

step2: Configuring webpack

proxy: {
    '/': {
      target: "http://x.x.x.x:port", // Please fill in the proxy service address output by http-proxy-404
      ws: false,
      changeOrigin: true,
    }
  }

step3: run serve.js

nodemon serve.js

or in your package.json

"scripts": {
    "dev": "webpack-dev-server xxx & nodemon serve.js"
  },

|Name|Required|Type|Default|Description| |:--:|:--:|:--:|:-----:|:----------| |port|false|{Number}| 8081 | Proxy service port,If the port is occupied will port++ and until the port is available| |log|false|{Boolean}|true|Whether to print the log| |apiReg|true|{RegExp}|null|Interface matching rule| |changeOrigin|false|{Boolean}|true| changes the origin of the host header to the target URL| |ws|false|{Boolean}|false|if you want to proxy websockets| |404func|false|{Function}|null|Custom function used to determine 404;Return true means you want to proxy next;Return false instead| |200func|false|{Function}|null|Custom function used to determine 200;Return true means you want to proxy next;Return false instead;If you return a string, it will be defaulted to the address of the mandatory proxy| |secure|false|{Boolean}|false|if you want to verify the SSL Certs|

2019-11-25:

  • 新增 参数配置 200func
  • 新增自动检测端口占用功能,并自动分配可用端口