Skip to content

bug: X-Forwarded-Proto header should not be set for upstream as a table #7215

Description

@nic-chen

Current Behavior

X-Forwarded-Proto header for upstream has been set as a table

Expected Behavior

X-Forwarded-Proto header for upstream should be set as a string

Error Logs

No response

Steps to Reproduce

  1. create a simple route:
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
    "uri": "/test",
    "upstream": {
        "type": "roundrobin",
        "nodes": {
            "127.0.0.1:8080": 1
        }
    }
}'
  1. visit the route:
curl 127.0.0.1:9080/test -H "X-Forwarded-Proto: http" -H "X-Test: test"  -H "X-Forwarded-Proto: http" -H "X-Test: test"
  1. the upstream will receive:
k: User-Agent, v: [curl/7.64.1]
k: X-Forwarded-For, v: [127.0.0.1]
k: X-Forwarded-Port, v: [9080]
k: X-Forwarded-Proto, v: [table: 0x1b70daa8]
k: X-Forwarded-Host, v: [127.0.0.1]
k: Accept, v: [*/*]
k: X-Test, v: [test test]
k: X-Real-Ip, v: [127.0.0.1]

see:
https://github.com/apache/apisix/blob/master/apisix/init.lua#L230-L233

Environment

  • APISIX version (run apisix version): master branch
  • Operating system (run uname -a): Darwin Kernel Version 19.6.0
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions