NGINX Reverse Proxy Configuration Rules
This module (`avarc-nginx`) provides a reverse proxy using NGINX with Paketo Buildpacks. It routes requests to backend services including frontend, backend API, Hydra, and Adminer.
View sourceNGINX Reverse Proxy Configuration Rules
Overview
This module (avarc-nginx) provides a reverse proxy using NGINX with Paketo Buildpacks. It routes requests to backend services including frontend, backend API, Hydra, and Adminer.
Architecture
- Build: Uses Paketo Buildpacks (
paketobuildpacks/builder-jammy-basewithdocker.io/paketobuildpacks/nginx) - Configuration:
nginx.confuses Paketo template syntax ({{env "VAR"}}and{{port}}) - MIME Types:
mime.typesfile is copied from resources during build
Key Responsibilities
- Reverse Proxy Routing: Routes requests to appropriate upstream services
- Security Headers: Implements security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy)
- Request Logging: JSON-formatted access logs with configurable exclusions
- Protocol Handling: Properly handles X-Forwarded-Proto for HTTPS behind proxies
Configuration Structure
Upstream Services
backend: Spring Boot backend API (configurable viaAPP_BACKEND_HOST/APP_BACKEND_PORT)frontend: Next.js frontend (configurable viaAPP_FRONTEND_HOST/APP_FRONTEND_PORT)adminer: Database admin tool (configurable viaAPP_ADMINER_HOST/APP_ADMINER_PORT)hydra_public: Ory Hydra public API (conditional, viaENABLE_HYDRA_PROXY)hydra_admin: Ory Hydra admin API (conditional, viaENABLE_HYDRA_PROXY)
Location Blocks
/actuator: Spring Boot Actuator endpoints/v3/api-docs,/swagger-ui.html,/swagger-ui/: OpenAPI documentation/adminer/: Database administration interface/hydra/: Ory Hydra public API (OAuth2/OIDC endpoints) - conditional/hydra-admin/: Ory Hydra admin API (client management) - conditional/: Default route to frontend (Next.js)
Environment Variables
NGINX_PORT: Port for NGINX to listen onAPP_BACKEND_HOST,APP_BACKEND_PORT: Backend service locationAPP_FRONTEND_HOST,APP_FRONTEND_PORT: Frontend service locationAPP_ADMINER_HOST,APP_ADMINER_PORT: Adminer service locationENABLE_HYDRA_PROXY: Enable Hydra proxy routes ("true" to enable)APP_HYDRA_PUBLIC_HOST,APP_HYDRA_PUBLIC_PORT: Hydra public API locationAPP_HYDRA_ADMIN_HOST,APP_HYDRA_ADMIN_PORT: Hydra admin API location
Security Considerations
- Production TODO: Secure
/actuator,/swagger-ui,/adminer, and/hydra-adminendpoints - Hydra Admin API: Should be restricted with IP whitelist, authentication, and rate limiting
- Hydra Public API: Consider rate limiting and IP-based restrictions
- All security headers are set at server level
Build Process
- Maven resources plugin copies
mime.typesto project root duringprepare-package - Paketo
packCLI builds Docker image using NGINX buildpack - Buildpack processes
nginx.conftemplate at runtime - Image uses
BP_NGINX_CONF_PATH=nginx.confandBP_NGINX_STATIC_ROOT=.
Development Guidelines
- Use Paketo template syntax for environment variable substitution
- Maintain JSON logging format for structured logs
- Exclude noisy paths from logging (webpack-hmr, favicon.ico)
- Always set proper proxy headers for upstream services
- Use
proxy_http_version 1.1for HTTP/1.1 connections - Support WebSocket upgrades for frontend (Upgrade, Connection headers)
Infrastructure Guidelines
- Configure as reverse proxy (primary function)
- Implement load balancing when multiple backend instances are available
- Set up SSL/TLS for production environments
- Configure secure HTTP headers (already implemented)
- Optimize performance settings (worker processes, connections)
- Set up proper logging (JSON format implemented)
- Implement caching strategies for static content
- Monitor performance and adjust configuration as needed
Testing
- Verify all upstream services are reachable
- Test conditional Hydra proxy routes
- Validate security headers in responses
- Check JSON log format output
- Verify protocol forwarding (X-Forwarded-Proto)
Related Documents
Design Document: BharatSeva AI
BharatSeva AI is a multi-agent orchestration system built on AWS using Amazon Bedrock Agents with Claude 3.5 Sonnet as the foundation model. The system deploys 10 AI agents (1 Master Orchestrator + 9 Specialist Agents) to assist India's informal sector workers in navigating government schemes across three domains: PM Vishwakarma (artisan credit), PMFBY (crop insurance), and BOCW (construction worker welfare).
OpenClaw Enterprise Transformation Plan
Transform OpenClaw from a single-user personal AI assistant into a **dual-mode platform** that is simultaneously:
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Daniel Sandner, for article on https://sandner.art/
Qwen3-TTS — Model Reference
Models: `Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice` and `Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice`