com.jimuwd.xian.registry-proxy 1.0.100 → 1.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -211,7 +211,16 @@ async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDow
|
|
|
211
211
|
// 必须使用 ServerResponse.setHeaders(safeHeaders)来覆盖现有headers而不是ServerResponse.writeHead(status,headers)来合并headers!
|
|
212
212
|
// 这个坑害我浪费很久事件来调试!
|
|
213
213
|
resToDownstreamClient.setHeaders(safeHeaders);
|
|
214
|
-
|
|
214
|
+
// 调试代码
|
|
215
|
+
resToDownstreamClient.removeHeader('Transfer-Encoding');
|
|
216
|
+
resToDownstreamClient.setHeader('Transfer-Encoding', 'chunked');
|
|
217
|
+
// 默认是 connection: keep-alive 和 keep-alive: timeout=5,这里直接给它咔嚓掉
|
|
218
|
+
resToDownstreamClient.removeHeader('Connection');
|
|
219
|
+
resToDownstreamClient.setHeader('Connection', 'close');
|
|
220
|
+
resToDownstreamClient.removeHeader('Keep-Alive');
|
|
221
|
+
resToDownstreamClient.removeHeader('content-type');
|
|
222
|
+
resToDownstreamClient.setHeader('content-type', contentType);
|
|
223
|
+
logger.info(`Response to downstream client headers`, JSON.stringify(resToDownstreamClient.getHeaders()), targetUrl);
|
|
215
224
|
resToDownstreamClient.writeHead(upstreamResponse.status);
|
|
216
225
|
// stop pipe when req from client is closed accidentally.
|
|
217
226
|
const cleanup = () => {
|