mirror of
https://github.com/d0zingcat/cors-anywhere.git
synced 2026-05-13 15:09:25 +00:00
Verify and update links to node-http-proxy
This commit is contained in:
@@ -88,7 +88,7 @@ function proxyRequest(req, res, proxy) {
|
||||
|
||||
/**
|
||||
* "Allow observer to modify headers or abort response"
|
||||
* https://github.com/nodejitsu/node-http-proxy/blob/05f0b891/lib/http-proxy/passes/web-incoming.js#L147
|
||||
* https://github.com/nodejitsu/node-http-proxy/blob/v1.11.1/lib/http-proxy/passes/web-incoming.js#L147
|
||||
*
|
||||
* This method modifies the response headers of the proxied response.
|
||||
* If a redirect is detected, the response is not sent to the client,
|
||||
@@ -138,7 +138,7 @@ function onProxyResponse(response, req, res) {
|
||||
// ### Dispose the current proxied request
|
||||
// Haha - hack! This should be fixed when (if?) node-http-proxy supports cancelation of requests..
|
||||
// Shadow all methods that mutate the |res| object.
|
||||
// See https://github.com/nodejitsu/node-http-proxy/blob/05f0b891/lib/http-proxy/passes/web-outgoing.js
|
||||
// See https://github.com/nodejitsu/node-http-proxy/blob/v1.11.1/lib/http-proxy/passes/web-outgoing.js#L73-L100
|
||||
var setHeader = res.setHeader;
|
||||
var writeHead = res.writeHead;
|
||||
res.setHeader = res.writeHead = function noop() {};
|
||||
@@ -147,7 +147,7 @@ function onProxyResponse(response, req, res) {
|
||||
res.setHeader = setHeader;
|
||||
res.writeHead = writeHead;
|
||||
// Trigger proxyReq.abort() (this is not of any imporance, it's just used to stop wasting resources.)
|
||||
// https://github.com/nodejitsu/node-http-proxy/blob/05f0b891/lib/http-proxy/passes/web-incoming.js#L125-L128
|
||||
// https://github.com/nodejitsu/node-http-proxy/blob/v1.11.1/lib/http-proxy/passes/web-incoming.js#L125-L128
|
||||
req.emit('aborted');
|
||||
// Remove all listeners (=reset events to initial state)
|
||||
req.removeAllListeners();
|
||||
|
||||
Reference in New Issue
Block a user