fix(admin-ui): proxy ingest API through Next.js rewrites (BIT-750)
The single-domain deployment (errors.bitreport.pt) routed all traffic through the admin-ui, whose auth middleware redirected /v1/ingest/events and /health to /login — making the ingest API unreachable from outside. - middleware.ts: pass through /v1/* and /health without auth redirect - next.config.ts: rewrite /v1/* and /health to ingest-api backend (INGEST_API_URL env, default http://127.0.0.1:3041) - docker-compose.yml: set INGEST_API_URL=http://ingest-api:3041 - env examples: document INGEST_API_URL - scripts/onboard-project.sh: generate project + ingest key SQL Paperclip-Agent: peter-spark Paperclip-Issue: BIT-750 Paperclip-Run: dc5b7949-b24d-4867-a2cd-cf4f47477ef8
This commit is contained in:
1 parent
c8adcac393
commit
3b175eec86
6 files changed
+128
No files matched your search
@@ -27,6 +27,14 @@ export function middleware(request: NextRequest) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
/** Ingest API paths — proxied to the ingest-api backend via next.config rewrites. */
|
||||
if (
|
||||
pathname === "/health" ||
|
||||
pathname.startsWith("/v1/")
|
||||
) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
if (_allowWithoutSession()) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
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";
|
||||
|
||||
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*` },
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
Reference in new issue
Block a user