mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 21:37:41 +00:00
<img width="1301" alt="Screenshot 2025-02-06 at 10 45 26 AM" src="https://github.com/user-attachments/assets/a7c79a6e-38a0-4627-b193-b33e5a84ad69" /> <img width="1218" alt="Screenshot 2025-02-06 at 3 52 28 PM" src="https://github.com/user-attachments/assets/34587cea-abd5-4176-86c0-a9a3f12f052a" /> --- TODO: - Search in sessions page - Event detail side panel - Search in session side panel - Design - Mark doesnt point to the right event on the sidebar (bug?) Co-authored-by: Ernest Iliiasov <20255948+ernestii@users.noreply.github.com>
38 lines
946 B
TypeScript
38 lines
946 B
TypeScript
import { NextApiRequest, NextApiResponse } from 'next';
|
|
import { createProxyMiddleware, fixRequestBody } from 'http-proxy-middleware';
|
|
|
|
const DEFAULT_SERVER_URL = `http://127.0.0.1:${process.env.HYPERDX_API_PORT}`;
|
|
|
|
export const config = {
|
|
api: {
|
|
externalResolver: true,
|
|
bodyParser: true,
|
|
},
|
|
};
|
|
|
|
export default (req: NextApiRequest, res: NextApiResponse) => {
|
|
const proxy = createProxyMiddleware({
|
|
changeOrigin: true,
|
|
// logger: console, // DEBUG
|
|
pathRewrite: { '^/api': '' },
|
|
target: process.env.NEXT_PUBLIC_SERVER_URL || DEFAULT_SERVER_URL,
|
|
autoRewrite: true,
|
|
/**
|
|
* Fix bodyParser
|
|
**/
|
|
on: {
|
|
proxyReq: fixRequestBody,
|
|
},
|
|
// ...(IS_DEV && {
|
|
// logger: console,
|
|
// }),
|
|
});
|
|
return proxy(req, res, error => {
|
|
if (error) {
|
|
console.error(error);
|
|
res.status(500).send('API proxy error');
|
|
return;
|
|
}
|
|
res.status(404).send('Not found');
|
|
});
|
|
};
|