Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法使用 IBM API Connect 传播用户代理标头?
我正在代理一个 REST/JSON 服务,并且用户代理被替换为“IBM-APIConnect/5.0”。
我需要它来进行跟踪。
您应该能够使用set-headerAPI 程序集中的策略来实现此目的,但您需要确保使用invoke策略而不是策略来访问后端端点proxy。
set-header
invoke
proxy
在invoke策略之前,添加一个set-variable策略。配置如下:
set-variable
Action: Set Set: user-agent Value: $(request.headers.user-agent)
这将从请求中获取传入的用户代理标头值并强制它覆盖 API Connect 默认值。