style: create images ux
This commit is contained in:
+26
-1
@@ -18,10 +18,35 @@ export default function createProxyTable(target?: string) {
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
buffer: false,
|
||||
selfHandleResponse: false,
|
||||
pathRewrite: (pth: string) => pth.replace(`/^/${api}`, `/${api}`),
|
||||
headers: {
|
||||
origin: newTarget,
|
||||
Connection: 'keep-alive'
|
||||
Connection: 'keep-alive',
|
||||
'Cache-Control': 'no-cache'
|
||||
},
|
||||
onProxyRes: (proxyRes: any, req: any, res: any) => {
|
||||
// let body = '';
|
||||
// proxyRes.on('data', (chunk) => {
|
||||
// body += chunk;
|
||||
// console.log('Received data from target server::::::::::', chunk);
|
||||
// });
|
||||
|
||||
// proxyRes.on('end', () => {
|
||||
// console.log('Received data from target server=================end');
|
||||
// console.log(body);
|
||||
// });
|
||||
if (req.headers.accept === 'text/event-stream') {
|
||||
res.writeHead(res.statusCode, {
|
||||
'Content-Type': 'text/event-stream',
|
||||
'Cache-Control': 'no-cache',
|
||||
Connection: 'keep-alive',
|
||||
'X-Accel-Buffering': 'no',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
});
|
||||
proxyRes.pipe(res);
|
||||
}
|
||||
}
|
||||
};
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user