Open alexlovelltroy opened 6 months ago
In https://github.com/OpenCHAMI/smd/pull/11 we replaced mux in favor of chi which enabled middleware. It's likely easier to standardize on this pattern for our services than it would be to revisit this choice anew for each microservice. CHI should be our default router and X-Header handling should be dealt with via middleware.
Standards for X-Headers in Microservice Architecture
Status
Proposed
Context
In our microservice architecture, there's a need for consistent and standardized communication between services. This includes the propagation of context, authentication information, and operational metadata. We currently rely on custom HTTP headers, known as X-Headers, to achieve this. Additionally, we use a Bearer token in the Authorization header for authentication purposes. The content and handling of the Bearer token are covered in #11. Additionally, considering the implications of header size limits is crucial for ensuring compatibility and optimal performance.
Decision
We have decided to adopt a standardized set of X-Headers across our microservices. These headers will be used to propagate request context, traceability data, and other operational metadata between services. The standard headers we will use are:
These headers must be respected and appropriately handled by all services within our architecture. Furthermore, considering the typical limits imposed by common web servers (e.g., Apache, Nginx, IIS), we decide to adhere to a general guideline of keeping the total size of HTTP headers under 8 KB. This size limitation ensures compatibility across various servers and mitigates performance and security issues associated with large headers.
Consequences
Open Questions