Files
errors.bitreport.pt/admin-ui/next.config.ts
T
tiago-nevesandPaperclip 050a380230
CI / Test ingest-api (push) Successful in 1m51s
CI / Test api (push) Successful in 1m50s
CI / Lint and typecheck admin-ui (push) Successful in 2m15s
CI / Validate Docker build (push) Successful in 7m29s
fix(admin-ui): proxy /api/error-monitoring/* to Fastify API (BIT-25083)
Next.js catches /api/* before Fastify, causing 404 on resolve-fixed-patterns.
Add rewrite so external callers (error-loop via CRM_RESOLVE_API_URL) reach
the hub Fastify API on port 3200 via the canonical errors.bitreport.pt URL.

Paperclip-Issue: BIT-25083
Co-Authored-By: Paperclip <[email protected]>
2026-06-14 02:23:41 +00:00

36 lines
1.1 KiB
TypeScript

import type { NextConfig } from "next";
/**
* Ingest API backend (same LXC, port 3041).
* In Docker Compose the service name is "ingest-api"; on bare-metal it is localhost.
*/
const INGEST_API_URL =
process.env.INGEST_API_URL || "http://127.0.0.1:3041";
/**
* Admin/mutation API backend (same LXC, port 3200).
* Proxies hub-only mutation endpoints (resolve-fixed-patterns, etc.) so they are
* reachable via the public errors.bitreport.pt hostname without a separate FQDN.
* BIT-25072: resolve-fixed-patterns is hub-only; CRM error-loop calls this via HTTPS.
*/
const ADMIN_API_URL =
process.env.ERROR_REPORTING_ADMIN_API_BASE || "http://127.0.0.1:3200";
const nextConfig: NextConfig = {
output: "standalone",
reactStrictMode: true,
async rewrites() {
return [
{ source: "/health", destination: `${INGEST_API_URL}/health` },
{ source: "/v1/:path*", destination: `${INGEST_API_URL}/v1/:path*` },
{
source: "/api/error-monitoring/:path*",
destination: `${ADMIN_API_URL}/api/error-monitoring/:path*`,
},
];
},
};
export default nextConfig;