Design and Implementation of JD.com Unified Header/Footer Management System
The article describes the background, overall architecture, backend management console, and client implementations (Nginx and Java) of JD.com's unified header/footer system, explaining how it enables rapid, centralized updates across hundreds of services using push/pull distribution, SSI, and caching techniques.
JD.com faced a challenge when needing to modify the common header and footer across hundreds of web applications, which traditionally required individual product requests, development scheduling, and testing, turning a simple content change into a product manager's nightmare.
To address this, JD.com built a Unified Header/Footer Management System that allows five‑minute updates of public header/footer content site‑wide.
System Overview
The system consists of two main parts: a management backend for maintaining header/footer files, versioning, and configuring the association between business systems and these files; and a client component deployed in business systems to fetch, render, and serve the latest header/footer content.
The client is split into a Java client for Java‑based services and an Nginx client for non‑Java services, both supporting various template engines (JSP, Velocity, FreeMarker, Thymeleaf) or Nginx SSI.
Management Backend Design
The backend follows a front‑end/back‑end separation model, exposing HTTP APIs while the UI handles rendering. It is organized into three modules:
File Management: create, edit, publish, roll back header/footer HTML with version control.
Application Management: register new business applications, configure environments, and map applications to specific header/footer files.
Personal Center: log user actions, provide operation logs, and handle approval workflows for publishing.
Client Distribution Strategy
Two distribution methods were evaluated: a push model where the header/footer system actively sends updates to each service, and a pull model where services periodically request updates. After weighing cross‑language support, port conflicts, and real‑time requirements, the pull model was chosen.
Two client implementations were created:
Nginx Client : leverages Nginx's ngx_http_ssi_module to include header/footer fragments via SSI directives (e.g., <!--# include file="/fragment/footer.html" --> ). URL rewriting and reverse‑proxy configuration fetch the fragment from the management system, while proxy_cache provides local caching to reduce load and improve latency. Sample configuration includes cache key, validity, stale handling, and header manipulation.
Java Client : runs as a background process within Java services. It downloads header/footer files at startup, then polls the management system for updates, caches files locally, parses template files for SSI include directives, and regenerates templates when changes are detected, eliminating runtime SSI overhead.
Both clients ensure that business services can render the latest header/footer without manual deployment, achieving near‑instantaneous site‑wide updates while maintaining performance and reliability.
JD Retail Technology
Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.