Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Docker + Apache Reverse Proxy + Internal CA Architecture

Posted on 2026-01-122026-01-12 by Rico

A Secure, Maintainable Design for Enterprise Environments

As enterprise systems move toward containerization, a common set of requirements quickly emerges:

  • Services are fully Dockerized
  • Only one public entry point is exposed
  • Apache is used as a Reverse Proxy
  • All internal traffic is encrypted (HTTPS)
  • Backend services use an Internal Certificate Authority (Internal CA)

This architecture is secure, scalable, and enterprise-friendly — but only if it is designed correctly.
Poor design choices often lead to serious problems such as:

  • Certificate sprawl and private key exposure
  • HTTPS without real certificate validation
  • Internal CA treated like a public CA
  • Excessive trust and unclear security boundaries

This article presents a production-ready reference architecture for Docker + Apache Reverse Proxy + Internal CA, focusing on long-term security and operability.


1. Architecture Goals

This design is built around four core principles:

  1. Expose Apache only
  2. Encrypt all internal traffic
  3. Use an Internal CA instead of public CAs
  4. Apply least trust and least exposure

2. High-Level Architecture

apache reverse proxy.drawio

Internet / Users
│ HTTPS (Public Certificate)
▼
+————————–+
| Apache Reverse Proxy |
| (Docker Container) |
+————————–+
│ HTTPS (Internal CA)
▼
+————————–+
| Backend Services |
| (Docker Containers) |
+————————–+

Internal CA
(Offline Root + Intermediate)

3. Internal CA Prerequisites (Critical)

Recommended CA Hierarchy

Offline Root CA
   └─ Intermediate CA
        ├─ Apache Proxy Certificate
        ├─ Backend Service A Certificate
        └─ Backend Service B Certificate

Key Rules

  • Root CA is always offline
  • Docker containers must never contain CA private keys
  • Only public CA certificates are distributed to containers

4. Apache Reverse Proxy Container Design

4.1 Apache’s Dual Role

In this architecture, Apache acts as:

  • HTTPS Server (public-facing)
  • HTTPS Client (connecting to backends)

👉 Apache becomes the central trust enforcement point.


4.2 Certificates Required in the Apache Container

Certificate TypePurpose
Public TLS certBrowser-facing HTTPS
Internal CA certValidate backend services
❌ CA private keysMust never exist here

4.3 Apache Reverse Proxy Configuration Example

SSLProxyEngine On

# Enforce strict backend certificate validation
SSLProxyVerify require
SSLProxyCheckPeerName on
SSLProxyCheckPeerExpire on

# Trust the Internal CA
SSLProxyCACertificateFile /etc/apache2/ssl/internal-ca.pem

ProxyPreserveHost On
ProxyPass        /api https://backend-api:8443/
ProxyPassReverse /api https://backend-api:8443/

📌 Important

  • backend-api is the Docker service name
  • The backend certificate SAN must include backend-api

5. Backend Service Container Design

5.1 Backend Responsibilities

Each backend service must:

  • Serve HTTPS
  • Use a server certificate issued by the Internal CA
  • Protect its private key with strict file permissions

5.2 Recommended Certificate Files

FileDescription
server.crtBackend service certificate
server.keyPrivate key (restricted access)
ca-chain.pemIntermediate + Root (if required)

⚠️ Backend containers usually do not need to trust the Root CA unless mutual TLS (mTLS) is used.


6. Docker Network Design (Security Boundary)

Strong Recommendation: Use an Internal Network

docker network create internal_net
networks:
  internal_net:
    internal: true

Benefits

  • Backend services are not reachable from outside
  • Even misconfigured HTTPS services remain isolated
  • Clear separation between public and private traffic

7. SNI and Docker Service Names (Commonly Overlooked)

When Apache connects to a backend using:

https://backend-api:8443

Apache sends:

SNI = backend-api

👉 Therefore, the backend certificate must include backend-api in its SAN.

Failure to align service names and certificates often results in:

  • Certificate validation failures
  • Wrong virtual host selection
  • Hard-to-debug proxy errors

8. Internal CA Best Practices in Docker Environments

✅ Recommended

  • Distribute CA public certificates only
  • Manage CA operations outside Docker
  • Automate certificate issuance and renewal via CI/CD or management hosts

❌ Avoid

  • Embedding CA private keys in images
  • Copying entire system trust stores into containers
  • Reusing one certificate across multiple services

9. Common Mistakes and Their Impact

MistakeConsequence
Disabling backend TLS verificationSilent MITM attacks
Sharing certificates across servicesOne leak compromises all
Bringing Root CA onlineIrrecoverable trust collapse
SAN mismatchProxy connection failures
No Docker network isolationAccidental service exposure

10. When Is This Architecture a Good Fit?

This design is ideal for:

  • Enterprise internal systems
  • ERP / EIP / API platforms
  • Mail, LDAP, and internal web services
  • Preparing for mTLS or Zero Trust adoption

Key Benefits

  • Clear trust boundaries
  • Long-term maintainability
  • Controlled certificate lifecycle
  • Containerization without sacrificing security

Conclusion: This Is Trust Engineering, Not Just Docker

Docker + Apache Reverse Proxy + Internal CA
is not merely about adding another HTTPS layer.

It is about building a controlled, auditable, and revocable trust model for enterprise systems.

When this foundation is solid, extending the architecture to:

  • Mutual TLS (mTLS)
  • Service mesh
  • Zero Trust
  • Hybrid cloud environments

becomes significantly easier and safer.

Recent Posts

  • Token/s and Concurrency:
  • Token/s 與並發:企業導入大型語言模型時,最容易被誤解的兩個指標
  • Running OpenCode AI using Docker
  • 使用 Docker 實際運行 OpenCode AI
  • Security Risks and Governance Models for AI Coding Tools

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • January 2026
  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • CUDA
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • Python
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2026 Nuface Blog | Powered by Superbs Personal Blog theme