You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have configured httproute.spec.rules.filters.requestHeaderModifier.add.name and httproute.spec.rules.filters.requestHeaderModifier.add.value in httproute. The values are X-Real-IP and remote_addr, respectively. httproute.spec.rules.filters.type is RequestHeaderModifier. However, in the nginx-gateway Pod, remote_addr is recognized as proxy_set_header X-Real-IP "${x_real_ip_header_var}remote_addr"; how can I configure it to recognize as proxy_set_header X-Real-IP "$remote_addr"? I have tried configuring httproute.spec.rules.filters.requestHeaderModifier.add.value as $remote_addr, but it causes all proxy_set_header commands in the nginx-gateway to not be recognized. How can I resolve this issue?
The text was updated successfully, but these errors were encountered:
Hi @Eason-Liu, we don't support setting nginx variables like $remote_addr in requestHeaderModifier filter, or any of the HeaderModifiers.
If you describe the HTTPRoute where you defined this requestHeaderModifier you should see an error like:
All rules are invalid: spec.rules[0].filters[0].RequestHeaderModifier.add: Invalid value: v1.HTTPHeader{Name:"X-Real-IP", Value:"$remote_addr"}: a valid value must have all '"' escaped and must not contain any '$' or end with an unescaped '\' (e.g. 'my-header-value', or 'example/12345==', regex used for validation is '([^"$\\]|\\[^$])*')
Can I ask what you are trying to achieve? Are you trying to preserve the client's IP address? Would this planned feature help: #1406?
Describe the bug
I have configured httproute.spec.rules.filters.requestHeaderModifier.add.name and httproute.spec.rules.filters.requestHeaderModifier.add.value in httproute. The values are X-Real-IP and remote_addr, respectively. httproute.spec.rules.filters.type is RequestHeaderModifier. However, in the nginx-gateway Pod, remote_addr is recognized as proxy_set_header X-Real-IP "${x_real_ip_header_var}remote_addr"; how can I configure it to recognize as proxy_set_header X-Real-IP "$remote_addr"? I have tried configuring httproute.spec.rules.filters.requestHeaderModifier.add.value as $remote_addr, but it causes all proxy_set_header commands in the nginx-gateway to not be recognized. How can I resolve this issue?
The text was updated successfully, but these errors were encountered: