英文:
istio send custom dynamic header to application by either using uuid or refer value from another already exiting header
问题
在Istio中,是否有一种方法可以设置自定义请求头(x-custom-header),其值是动态值(uuid),或者可以从已经存在的头部设置自定义头的值?
我正在使用网关 + 虚拟服务 + Envoy(sidecar)。
在nginx中的示例配置选项为:
proxy_set_header x-custom-header $connection:$connection_requests;
我在我的虚拟服务中尝试了下面的代码片段,但将字面值 "{{ uuid }}" 转发到了我的应用程序。
http:
- headers:
request:
set:
x-custom-header: '{{ uuid() }}'
match:
- uri:
prefix: /
英文:
Is there way in istio to set a custom request header (x-custom-header) with value as dynamic value (uuid) or setting value of the custom header from an already existing header?
I am using gateway + virtualservice + envoy(sidecar)
Example configuration options in nginx =
proxy_set_header x-custom-header $connection:$connection_requests;
I tried below snippet in my virtual service and got literal value "{{ uuid }}" forwarded to my application.
` http:
-
headers:
request:
set:
x-custom-header: '{{ uuid() }}'match:
- uri:
prefix: /`
- uri:
答案1
得分: 1
我能够通过在虚拟服务中使用以下代码片段来解决这个问题:
- headers:
request:
set:
x-custom-header: '%REQ(x-request-id)%'
英文:
I was able to solve this by using following snippet in virtual service
http:
- headers:
request:
set:
x-custom-header: '%REQ(x-request-id)%'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论