request help: The X-Forwarded-For header of the request to the upstream cannot be changed #5091
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Currently, we always override the XFF in Line 597 in c907ef0 We can handle it like X-Forwarded-Proto in Line 271 in c907ef0 PR is welcome! |
Beta Was this translation helpful? Give feedback.
-
Do we need to write a plug-in ourselves? |
Beta Was this translation helpful? Give feedback.
-
Can be handled in this way temporarily curl -i http://127.0.0.1:9080/apisix/admin/routes/10 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/test/index.html",
"plugins": {
"serverless-pre-function": {
"phase": "rewrite",
"functions": [
"return function(conf, ctx) ngx.var.var_x_forwarded_for = tostring(\"1.1.1.1\") end"
]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}' |
Beta Was this translation helpful? Give feedback.
-
@shuaijinchao There is only one difference in variable name between Kong gateway and APISIX gateway: |
Beta Was this translation helpful? Give feedback.
Can be handled in this way temporarily