http-proxy-middleware
Advanced tools
Comparing version 0.17.2 to 0.17.3
# Changelog | ||
## [v0.17.3](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.3) | ||
- fix(onError): improve default proxy error handling. http status codes (504, 502 and 500). ([#132](https://github.com/chimurai/http-proxy-middleware/pull/132)) ([graingert](https://github.com/graingert)) | ||
## [v0.17.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.2) | ||
@@ -4,0 +7,0 @@ - feat(logging): improve error message & add link to Node errors page. ([#106](https://github.com/chimurai/http-proxy-middleware/pull/106)) ([cloudmu](https://github.com/cloudmu)) |
@@ -51,5 +51,17 @@ var _ = require('lodash'); | ||
var host = (req.headers && req.headers.host); | ||
var code = err.code; | ||
if (res.writeHead && !res.headersSent) { | ||
res.writeHead(500); | ||
if (/HPE_INVALID/.test(code)) { | ||
res.writeHead(502); | ||
} else { | ||
switch(code) { | ||
case 'ECONNRESET': | ||
case 'ENOTFOUND': | ||
case 'ECONNREFUSED': | ||
res.writeHead(504); | ||
break; | ||
default: res.writeHead(500); | ||
} | ||
} | ||
} | ||
@@ -56,0 +68,0 @@ |
{ | ||
"name": "http-proxy-middleware", | ||
"version": "0.17.2", | ||
"version": "0.17.3", | ||
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync", | ||
@@ -42,10 +42,10 @@ "main": "index.js", | ||
"devDependencies": { | ||
"browser-sync": "^2.14.0", | ||
"browser-sync": "^2.18.2", | ||
"chai": "^3.5.0", | ||
"connect": "^3.4.1", | ||
"coveralls": "^2.11.12", | ||
"connect": "^3.5.0", | ||
"coveralls": "^2.11.15", | ||
"express": "^4.14.0", | ||
"istanbul": "^0.4.4", | ||
"istanbul": "^0.4.5", | ||
"istanbul-coveralls": "^1.0.3", | ||
"mocha": "^3.0.2", | ||
"mocha": "^3.2.0", | ||
"mocha-lcov-reporter": "1.2.0", | ||
@@ -56,7 +56,7 @@ "opn": "^4.0.2", | ||
"dependencies": { | ||
"http-proxy": "^1.15.1", | ||
"is-glob": "^3.0.0", | ||
"lodash": "^4.16.2", | ||
"http-proxy": "^1.16.2", | ||
"is-glob": "^3.1.0", | ||
"lodash": "^4.17.2", | ||
"micromatch": "^2.3.11" | ||
} | ||
} |
@@ -110,4 +110,4 @@ # http-proxy-middleware | ||
pathRewrite: { | ||
'^/old/api' : '/new/api', // rewrite path | ||
'^/remove/api' : '/api' // remove path | ||
'^/api/old-path' : '/api/new-path', // rewrite path | ||
'^/api/remove/path' : '/path' // remove base path | ||
}, | ||
@@ -308,6 +308,6 @@ router: { | ||
* **option.toProxy**: true/false, passes the absolute URL as the `path` (useful for proxying to proxies) | ||
* **option.prependPath**: true/false, Default: true - specify whether you want to prepend the target's path to the proxy path> | ||
* **option.ignorePath**: true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request> | ||
* **option.prependPath**: true/false, Default: true - specify whether you want to prepend the target's path to the proxy path | ||
* **option.ignorePath**: true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request (note: you will have to append / manually if required). | ||
* **option.localAddress** : Local interface string to bind for outgoing connections | ||
* **option.changeOrigin**: true/false, adds host to request header. | ||
* **option.changeOrigin**: true/false, Default: false - changes the origin of the host header to the target URL | ||
* **option.auth** : Basic authentication i.e. 'user:password' to compute an Authorization header. | ||
@@ -317,5 +317,19 @@ * **option.hostRewrite**: rewrites the location hostname on (301/302/307/308) redirects. | ||
* **option.protocolRewrite**: rewrites the location protocol on (301/302/307/308) redirects to 'http' or 'https'. Default: null. | ||
* **option.cookieDomainRewrite**: rewrites domain of `set-cookie` headers. Possible values: | ||
* `false` (default): disable cookie rewriting | ||
* String: new domain, for example `cookieDomainRewrite: "new.domain"`. To remove the domain, use `cookieDomainRewrite: ""`. | ||
* Object: mapping of domains to new domains, use `"*"` to match all domains. | ||
For example keep one domain unchanged, rewrite one domain and remove other domains: | ||
``` | ||
cookieDomainRewrite: { | ||
"unchanged.domain": "unchanged.domain", | ||
"old.domain": "new.domain", | ||
"*": "" | ||
} | ||
``` | ||
* **option.headers**: object, adds [request headers](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields). (Example: `{host:'www.example.org'}`) | ||
* **option.proxyTimeout**: timeout (in millis) when proxy receives no response from target | ||
## Shorthand | ||
@@ -322,0 +336,0 @@ |
45426
599
448
Updatedhttp-proxy@^1.16.2
Updatedis-glob@^3.1.0
Updatedlodash@^4.17.2