Skip to content

AMI: route AI Gateway / Hub agent surface / SCIM through nginx#23

Merged
Nexus-ABC merged 1 commit into
mainfrom
feat/ami-nginx-service-routes
May 30, 2026
Merged

AMI: route AI Gateway / Hub agent surface / SCIM through nginx#23
Nexus-ABC merged 1 commit into
mainfrom
feat/ami-nginx-service-routes

Conversation

@Nexus-ABC
Copy link
Copy Markdown
Contributor

Summary

The appliance's nginx-nexus.conf only reverse-proxied the Control Plane (/api, /oauth, /authserver, /.well-known, /healthz). Every other service surface fell through to the SPA try_files, so the AI Gateway was unreachable over 443 even though first-boot advertises publicURL https://<ip>/v1. This wires up the missing surfaces.

Found while debugging a live deployment: GET https://<ip>/v1/models returned the UI's index.html (HTTP 200 text/html), and /healthz returned {"message":"Not Found"} (404).

No new ports and no EC2 Security Group change — everything rides on 443, which is already open.

Changes (nexus-ami/artifacts/configs/nginx-nexus.conf)

  • AI Gateway (:3050) — one regex location covering /v1, /v1beta, /openai/deployments, /api/paas (OpenAI / Gemini / Azure / GLM ingress wire formats). Regex so /api/paas wins over the plain /api/ prefix. proxy_buffering off + HTTP/1.1 so SSE streaming relays chunk-by-chunk.
  • Nexus Hub (:3060)/ws (WebSocket upgrade, 1h read timeout) and /api/internal/things/ (agent enrollment + thingclient HTTP fallback) so remote endpoint-agents can enroll/connect over 443. Confirmed no namespace clash: CP's /api/internal only registers /auth/revoke-device. Bearer/device/enrollment-token gated by the Hub. The Hub admin API (/api/hub/*) and /metrics stay loopback-only.
  • SCIM/scim/ → Control Plane for Okta/Entra user provisioning.
  • /api/ — added proxy_buffering off so admin SSE (compliance-overview export, AI Gateway Simulator forward) streams.
  • /healthz bug fix — was proxy_pass .../api/healthz (CP serves /healthz at root → 404). Now preserves the path. Added /ready.

Verification

  • Route surface cross-checked against actual registrations: AI Gateway routes.go (/v1/*, /v1beta, /openai/deployments, /api/paas), Hub routes.go (GET /ws, /api/internal/things/*), CP routes.go (/scim/v2, /healthz, /ready, /api/internal/auth only).
  • nginx brace balance verified (18/18); regex-vs-prefix precedence reasoned through for the /api/paas and /api/internal/things/ cases.
  • Intentionally NOT exposed: gateway /internal/*, both /metrics, CP /debug/runtime, Hub /api/hub/*.

Security note

/v1/*, /ws, and /api/internal/things/* become internet-reachable. They are not anonymous: /v1/* requires a virtual key; the Hub agent surface is gated by per-device / enrollment / internal-service tokens. Documented in nexus-ami/README.md along with the endpoint map, an OpenAI-verification curl, and the remote-agent enrollment command.

Note: independent of #22 (branched from main); touches different files, no conflict.

🤖 Generated with Claude Code

The appliance nginx only proxied the Control Plane (/api, /oauth,
/authserver, /.well-known, /healthz). Every other service surface fell
through to the SPA, so the AI Gateway was unreachable over 443 despite
first-boot advertising publicURL https://<ip>/v1.

nginx-nexus.conf:
- AI Gateway (:3050): one regex location for /v1, /v1beta,
  /openai/deployments, /api/paas (OpenAI/Gemini/Azure/GLM ingress),
  regex so /api/paas wins over the plain /api/ prefix; proxy_buffering
  off + HTTP/1.1 for SSE streaming.
- Nexus Hub (:3060): /ws (WebSocket upgrade, 1h timeout) and
  /api/internal/things/ (enrollment + thingclient HTTP fallback) so
  remote agents can enroll/connect over 443. Token-gated by the Hub;
  /api/hub admin + /metrics stay loopback-only.
- SCIM: /scim/ -> Control Plane for Okta/Entra provisioning.
- /api/: proxy_buffering off so admin SSE (compliance export, AI
  Gateway Simulator forward) streams instead of buffering.
- /healthz: was proxied to CP /api/healthz which 404s; CP serves
  /healthz at root. proxy_pass now preserves the path. Added /ready.

No new ports or EC2 Security Group changes — everything rides on 443
(already open). README documents the endpoint map, OpenAI verification
curl, remote-agent enrollment, and the internet-exposure security note.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Nexus-ABC Nexus-ABC merged commit fa43df1 into main May 30, 2026
5 checks passed
@Nexus-ABC Nexus-ABC deleted the feat/ami-nginx-service-routes branch June 3, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant