mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[linter] run prettier
This commit is contained in:
@ -179,25 +179,25 @@ docsCoServer.install(server, app, () => {
|
||||
const proxyToAdmin =
|
||||
(pathPrefix = '') =>
|
||||
(req, res) => {
|
||||
const targetPath = pathPrefix + req.url;
|
||||
const options = {
|
||||
hostname: 'localhost',
|
||||
port: 9000,
|
||||
path: targetPath,
|
||||
method: req.method,
|
||||
headers: {...req.headers, host: 'localhost:9000'}
|
||||
const targetPath = pathPrefix + req.url;
|
||||
const options = {
|
||||
hostname: 'localhost',
|
||||
port: 9000,
|
||||
path: targetPath,
|
||||
method: req.method,
|
||||
headers: {...req.headers, host: 'localhost:9000'}
|
||||
};
|
||||
|
||||
const proxyReq = http.request(options, proxyRes => {
|
||||
res.status(proxyRes.statusCode);
|
||||
Object.entries(proxyRes.headers).forEach(([key, value]) => res.setHeader(key, value));
|
||||
proxyRes.pipe(res);
|
||||
});
|
||||
|
||||
proxyReq.on('error', () => res.sendStatus(502));
|
||||
req.pipe(proxyReq);
|
||||
};
|
||||
|
||||
const proxyReq = http.request(options, proxyRes => {
|
||||
res.status(proxyRes.statusCode);
|
||||
Object.entries(proxyRes.headers).forEach(([key, value]) => res.setHeader(key, value));
|
||||
proxyRes.pipe(res);
|
||||
});
|
||||
|
||||
proxyReq.on('error', () => res.sendStatus(502));
|
||||
req.pipe(proxyReq);
|
||||
};
|
||||
|
||||
app.use('/api/v1/admin', proxyToAdmin('/api/v1/admin'));
|
||||
app.all('/admin', (req, res, next) => {
|
||||
if (req.path === '/admin' && !req.path.endsWith('/')) {
|
||||
|
||||
Reference in New Issue
Block a user