Reverse Proxy

Master this essential documentation concept

Quick Definition

A server that sits between users and a web application, forwarding requests on behalf of clients. In documentation, it is often used to serve content from multiple sources under a single custom domain.

How Reverse Proxy Works

graph TD User([👤 End User / Browser]) RP[🔀 Reverse Proxy nginx / Caddy / Traefik] Docs[📄 Docs Site docs.example.com/docs] API[⚙️ API Reference docs.example.com/api] Blog[📝 Developer Blog docs.example.com/blog] Auth[🔐 Auth Service SSO / OAuth2] User -->|HTTPS Request docs.example.com| RP RP -->|Route /docs/*| Docs RP -->|Route /api/*| API RP -->|Route /blog/*| Blog RP -->|Validate Token| Auth Auth -->|Allow / Deny| RP style RP fill:#f4a261,stroke:#e76f51,color:#000 style User fill:#457b9d,stroke:#1d3557,color:#fff style Docs fill:#2a9d8f,stroke:#264653,color:#fff style API fill:#2a9d8f,stroke:#264653,color:#fff style Blog fill:#2a9d8f,stroke:#264653,color:#fff style Auth fill:#e9c46a,stroke:#f4a261,color:#000

Understanding Reverse Proxy

A server that sits between users and a web application, forwarding requests on behalf of clients. In documentation, it is often used to serve content from multiple sources under a single custom domain.

Key Features

  • Centralized information management
  • Improved documentation workflows
  • Better team collaboration
  • Enhanced user experience

Benefits for Documentation Teams

  • Reduces repetitive documentation tasks
  • Improves content consistency
  • Enables better content reuse
  • Streamlines review processes

Documenting Your Reverse Proxy Setup: From Recorded Walkthroughs to Searchable Reference

When teams configure a reverse proxy to unify multiple content sources under a single domain, the setup process is rarely straightforward. Engineers often record their configuration walkthroughs, architecture reviews, or troubleshooting sessions as the most practical way to capture what was done and why — particularly when routing rules, SSL termination, and upstream server definitions are involved.

The problem is that a recorded session explaining your reverse proxy configuration is effectively locked away. When a new team member needs to understand why traffic from a specific path routes to a particular backend, or when something breaks at 2 AM, scrubbing through a 45-minute video to find the relevant segment is not a realistic option. Reverse proxy logic tends to be highly specific to your infrastructure, which makes generic documentation scarce and your internal recordings even more valuable — if they were actually accessible.

Converting those recordings into structured, searchable documentation changes this entirely. Your reverse proxy configuration decisions, the reasoning behind routing rules, and edge cases discovered during setup become text that your team can search, link to, and update as your infrastructure evolves. A developer can query "upstream timeout configuration" and land directly on the relevant explanation rather than rewatching an entire architecture call.

Real-World Documentation Use Cases

Unifying Docs, API Reference, and Changelog Under a Single Custom Domain

Problem

Teams host their user guide on Docusaurus, their API reference on Redoc, and their changelog on a third-party service like Beamer. Users must navigate three separate domains, breaking brand consistency and making SEO fragmented across subdomains.

Solution

A reverse proxy (e.g., nginx or Caddy) routes all traffic under docs.company.com, mapping /docs to Docusaurus, /api to Redoc, and /changelog to the Beamer embed—all served as a unified site.

Implementation

['Deploy each documentation service independently on internal ports or subdomains (e.g., Docusaurus on :3000, Redoc on :3001).', 'Configure nginx location blocks to proxy_pass each path prefix to the corresponding upstream service, preserving headers and base paths.', "Add SSL termination at the reverse proxy layer using Let's Encrypt or a wildcard certificate so all routes share HTTPS under docs.company.com.", 'Set Cache-Control headers at the proxy level for static assets from each service to improve load times globally.']

Expected Outcome

All documentation is accessible under a single domain with consistent branding, and SEO authority consolidates to one domain, improving search rankings for developer queries.

Gating Internal Engineering Docs Behind SSO Without Modifying the Docs Tool

Problem

Engineering teams using MkDocs or Sphinx for internal runbooks cannot add SSO authentication natively to the static site generator. Sensitive architecture docs are either publicly accessible or require a separate VPN-only deployment.

Solution

A reverse proxy with an auth middleware (e.g., Traefik with Forward Auth, or nginx with oauth2-proxy) intercepts all requests to the internal docs site and validates the user's identity against an Okta or Google Workspace SSO provider before forwarding.

Implementation

["Deploy oauth2-proxy as a sidecar service configured to authenticate against your organization's Okta OIDC application.", 'Configure Traefik or nginx to forward all requests to /internal-docs to the oauth2-proxy middleware first, redirecting unauthenticated users to the SSO login page.', "On successful authentication, the proxy forwards the request to the MkDocs static file server with the user's identity headers attached.", 'Set session cookie expiry and whitelist allowed email domains in the oauth2-proxy configuration to restrict access to company accounts only.']

Expected Outcome

Internal documentation is protected by corporate SSO without any changes to the MkDocs source or build pipeline, and access logs at the proxy layer provide a clear audit trail of who viewed sensitive docs.

Zero-Downtime Documentation Deployments with Blue-Green Routing

Problem

When publishing major documentation updates—such as a new API version or a complete site redesign—teams experience brief outages or serve partially updated content as static files are overwritten during deployment, confusing users mid-session.

Solution

A reverse proxy manages two live upstream environments (blue and green). New documentation builds are deployed to the idle environment, validated, and then traffic is switched at the proxy level instantly with no downtime.

Implementation

['Maintain two identical documentation server instances (blue on port 8080, green on port 8081) behind the nginx upstream block.', 'Deploy the new Docusaurus or Hugo build to the currently inactive environment and run automated link-checking and smoke tests against it directly via its port.', 'Update the nginx upstream configuration to point docs.company.com to the newly validated environment and reload nginx with nginx -s reload (zero-downtime reload).', 'Keep the previous environment running for 15 minutes as a fallback, then decommission it after confirming no errors in proxy access logs.']

Expected Outcome

Documentation updates go live in under one second of proxy reload time, with zero broken pages for active users and a tested rollback path available within minutes.

Serving Versioned Documentation for Multiple Product Releases Simultaneously

Problem

SaaS companies maintaining documentation for v1, v2, and v3 of their API struggle to host each version separately. Users on older integrations need access to legacy docs, but the team cannot afford to run and maintain three fully separate web hosting setups.

Solution

A reverse proxy routes version-specific URL prefixes (/v1/, /v2/, /v3/) to separate lightweight static file servers or S3 buckets, each containing the built documentation snapshot for that release.

Implementation

['Build and store versioned documentation snapshots in separate S3 buckets or directories (e.g., docs-v1.s3.amazonaws.com, docs-v2.s3.amazonaws.com).', 'Configure Caddy or nginx location blocks to proxy each /vN/ prefix to its corresponding S3 origin, rewriting the URI to strip the version prefix before forwarding.', 'Add a redirect rule at the proxy level so that bare requests to docs.company.com/api redirect to /v3/ (the latest stable version).', 'Cache versioned responses aggressively at the proxy (e.g., Cache-Control: max-age=86400) since historical docs rarely change, reducing origin load.']

Expected Outcome

All three API versions remain publicly accessible under one domain with clean URLs, and hosting costs stay minimal since only the proxy server handles TLS and routing while static files are served from cheap object storage.

Best Practices

Terminate TLS at the Reverse Proxy, Never at the Docs Origin

The reverse proxy should be the single point of SSL/TLS termination for all documentation traffic. This centralizes certificate management (e.g., via Let's Encrypt auto-renewal with Caddy or Certbot) and avoids the complexity of provisioning certificates on each individual docs service. Internal traffic between the proxy and upstream docs servers can use plain HTTP on a private network.

✓ Do: Configure your reverse proxy (nginx, Caddy, or Traefik) to handle HTTPS with automatic certificate renewal, and communicate with upstream Docusaurus or MkDocs servers over HTTP on localhost or a private VLAN.
✗ Don't: Do not configure self-signed certificates on each individual documentation service and chain them through the proxy, as this creates certificate management overhead and can cause TLS handshake errors that are difficult to debug.

Use Path-Based Routing with Explicit Prefix Stripping for Each Docs Service

When routing /api, /docs, and /guides to separate upstream services, you must strip the location prefix before forwarding the request, or the upstream server will receive a path it does not recognize. For example, Redoc served at /api should receive / at its origin, not /api/. Failure to strip prefixes is one of the most common misconfiguration issues in documentation proxy setups.

✓ Do: Use proxy_strip_prefix in Traefik or a rewrite rule in nginx (e.g., rewrite ^/api(/.*)$ $1 break) to remove the routing prefix before forwarding to the upstream documentation service.
✗ Don't: Do not forward the full request path (e.g., /api/endpoints) to an upstream service that only knows about /endpoints, as this will result in 404 errors for all proxied documentation pages.

Set Appropriate Cache Headers at the Proxy Layer for Static Documentation Assets

Documentation sites consist largely of static assets—CSS, JavaScript bundles, and images—that change only on new deployments. Configuring the reverse proxy to set long-lived Cache-Control headers for these assets dramatically reduces origin load and improves page load times for readers globally. Pair this with cache-busting via content-hashed filenames in your static site generator.

✓ Do: Add proxy_set_header Cache-Control 'public, max-age=31536000, immutable' for static asset paths like /assets/, /_next/static/, or /static/ at the nginx or Caddy layer, since modern docs generators (Docusaurus, Next.js) output content-hashed filenames.
✗ Don't: Do not apply long cache TTLs to HTML pages themselves (e.g., /docs/getting-started), as these change with every documentation update and aggressive caching will cause readers to see stale content after deployments.

Configure Health Checks and Automatic Failover for Upstream Documentation Services

If a documentation upstream (e.g., a Docusaurus dev server or a containerized MkDocs instance) crashes, the reverse proxy should detect the failure quickly and serve a meaningful error page rather than timing out user requests. Most production-grade proxies support active health checks with configurable intervals and thresholds.

✓ Do: Enable upstream health checks in nginx (using the ngx_http_upstream_hc_module) or Traefik's health check configuration, and define a custom 502/503 error page that links users to a status page or cached version of the docs.
✗ Don't: Do not leave the default proxy timeout at 60 seconds without a fallback, as users will stare at a loading spinner for a full minute before seeing an error when a docs upstream goes down.

Log Structured Access Data at the Proxy for Documentation Analytics and Debugging

The reverse proxy is the single choke point through which all documentation traffic flows, making it the ideal place to capture structured access logs. These logs can feed into analytics pipelines to understand which documentation pages are most visited, identify 404 errors from broken external links, and debug routing misconfigurations without modifying individual docs services.

✓ Do: Configure nginx or Caddy to emit JSON-formatted access logs including fields like request_uri, upstream_addr, status, request_time, and http_referer, then ship these to a log aggregator like Loki, Datadog, or Elasticsearch for querying and alerting on documentation 404 rates.
✗ Don't: Do not rely solely on client-side analytics scripts (e.g., Google Analytics embedded in the docs theme) for traffic data, as ad blockers suppress these for a significant portion of developer audiences, making proxy-level logs the more complete and reliable data source.

How Docsie Helps with Reverse Proxy

Build Better Documentation with Docsie

Join thousands of teams creating outstanding documentation

Start Free Trial