vira/hpropagate
最新稳定版本:v1.0.3
Composer 安装命令:
composer require vira/hpropagate
包简介
Symfony bundle for propagating http headers from incoming requests to the corresponding outgoing requests automatically
README 文档
README
This package automatically propagates HTTP headers from inbound to outbound HTTP requests. It also will add a request ID to all monolog logs under req.id to follow the format used in our node services here
Requirements
- PHP >= 8.1
- Symfony 6.3.x
The Why
We use a microservice architecture with a growing number of HTTP endpoints. We want to propagate certain HTTP headers received from the incoming HTTP requests to all subsequent outbound HTTP requests without the need for our engineers to do it programmatically in each service:
By default, the following headers are automatically propagated:
- x-request-id. If the header is missing from the inbound request, it will be created with a UUID as value.
Apart from x-request-id, only headers received on the incoming request will be propagated to outbound calls.
Installation
composer require vira/hpropagate
Then add the following to your bundles file:
Vira\Hpropagate\ViraHpropagateBundle::class => ['all' => true
Configuration
There is some optional configuration to be able to propagate more headers than just x-request-id:
# config/packages/vira_hpropagate.yaml vira_hpropagate: headers_to_propagate: - x-my-custom-header - my-other-header
统计信息
- 总下载量: 2.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-26