Socket
Socket
Sign inDemoInstall

http-proxy-middleware

Package Overview
Dependencies
18
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1-beta.0

4

dist/errors.d.ts
export declare enum ERRORS {
ERR_CONFIG_FACTORY_TARGET_MISSING = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}",
ERR_CONTEXT_MATCHER_GENERIC = "[HPM] Invalid context. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]",
ERR_CONTEXT_MATCHER_INVALID_ARRAY = "[HPM] Invalid pathFilter. Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"]",
ERR_CONTEXT_MATCHER_GENERIC = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]",
ERR_CONTEXT_MATCHER_INVALID_ARRAY = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].",
ERR_PATH_REWRITER_CONFIG = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function"
}

@@ -7,5 +7,5 @@ "use strict";

ERRORS["ERR_CONFIG_FACTORY_TARGET_MISSING"] = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}";
ERRORS["ERR_CONTEXT_MATCHER_GENERIC"] = "[HPM] Invalid context. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]";
ERRORS["ERR_CONTEXT_MATCHER_INVALID_ARRAY"] = "[HPM] Invalid pathFilter. Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"]";
ERRORS["ERR_CONTEXT_MATCHER_GENERIC"] = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]";
ERRORS["ERR_CONTEXT_MATCHER_INVALID_ARRAY"] = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].";
ERRORS["ERR_PATH_REWRITER_CONFIG"] = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function";
})(ERRORS || (exports.ERRORS = ERRORS = {}));
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loggerPlugin = void 0;
const url_1 = require("url");
const logger_1 = require("../../logger");

@@ -26,3 +27,7 @@ const loggerPlugin = (proxyServer, options) => {

const originalUrl = req.originalUrl ?? `${req.baseUrl || ''}${req.url}`;
const exchange = `[HPM] ${req.method} ${originalUrl} -> ${proxyRes.req.protocol}//${proxyRes.req.host}${proxyRes.req.path} [${proxyRes.statusCode}]`;
// construct targetUrl
const target = new url_1.URL(options.target);
target.pathname = proxyRes.req.path;
const targetUrl = target.toString();
const exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`;
logger.info(exchange);

@@ -29,0 +34,0 @@ });

@@ -14,3 +14,3 @@ /**

export interface RequestHandler<TReq = http.IncomingMessage, TRes = http.ServerResponse, TNext = NextFunction> {
(req: TReq, res: TRes, next?: TNext): void | Promise<void>;
(req: TReq, res: TRes, next?: TNext): Promise<void>;
upgrade: (req: http.IncomingMessage, socket: net.Socket, head: Buffer) => void;

@@ -17,0 +17,0 @@ }

{
"name": "http-proxy-middleware",
"version": "3.0.0",
"version": "3.0.1-beta.0",
"description": "The one-liner node.js proxy middleware for connect, express, next.js and more",

@@ -25,2 +25,5 @@ "main": "dist/index.js",

},
"publishConfig": {
"provenance": true
},
"repository": {

@@ -55,4 +58,4 @@ "type": "git",

"devDependencies": {
"@commitlint/cli": "17.7.1",
"@commitlint/config-conventional": "17.7.0",
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@types/debug": "4.1.12",

@@ -63,7 +66,7 @@ "@types/express": "4.17.21",

"@types/micromatch": "4.0.6",
"@types/node": "20.11.30",
"@types/supertest": "2.0.12",
"@types/node": "20.12.5",
"@types/supertest": "6.0.2",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "7.4.0",
"@typescript-eslint/parser": "7.4.0",
"@typescript-eslint/eslint-plugin": "7.6.0",
"@typescript-eslint/parser": "7.6.0",
"body-parser": "1.20.2",

@@ -80,3 +83,3 @@ "browser-sync": "3.0.2",

"lint-staged": "15.2.2",
"mockttp": "3.10.1",
"mockttp": "3.10.2",
"open": "8.4.2",

@@ -86,3 +89,3 @@ "prettier": "3.2.5",

"ts-jest": "29.1.2",
"typescript": "5.4.3",
"typescript": "5.4.4",
"ws": "8.16.0"

@@ -89,0 +92,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc