Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: when use response rewrite plugin, scenarios that return an empty body cannot be supported #7722

Closed
Hazel6869 opened this issue Aug 17, 2022 · 2 comments · Fixed by #7836
Assignees

Comments

@Hazel6869
Copy link
Contributor

Current Behavior

➜ example git:(master) ✗ curl http://127.0.0.1:9080/apisix/admin/routes/1
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET"],
"uri": "/get",
"plugins": {
"response-rewrite": {
"body_base64":false,
"body": "",
"headers": {
"X-Server-id": 3,
"X-Server-status": "on",
"X-Server-balancer_addr": "$balancer_ip:$balancer_port"
},
"vars":[
[ "status","==",200 ]
]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org": 1
}
}
}'

➜ example git:(master) ✗ curl -X GET -i http://127.0.0.1:9080/get
HTTP/1.1 502 Bad Gateway
Connection: keep-alive
Keep-Alive: timeout=4
Proxy-Connection: keep-alive
Content-Length: 0

Expected Behavior

➜ example git:(master) ✗ curl -X GET -i http://127.0.0.1:9080/get
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json
Date: Wed, 17 Aug 2022 08:44:10 GMT
Keep-Alive: timeout=4
Proxy-Connection: keep-alive
Server: APISIX/2.15.0
X-Server-Balancer-Addr: 34.227.213.82:80
X-Server-Id: 3
X-Server-Status: on

Error Logs

No response

Steps to Reproduce

I will fix this

Environment

  • APISIX version (run apisix version): version 2.15.0
  • Operating system (run uname -a): Linux lan 5.15.0-41-generic doc: add qq group. #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V): ginx version: openresty/1.21.4.1
    built with OpenSSL 1.1.1n 15 Mar 2022
  • etcd version, if relevant (run ):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@tokers
Copy link
Contributor

tokers commented Aug 17, 2022

@Hazel6869 Would you try to fix it?

@Hazel6869
Copy link
Contributor Author

Hazel6869 commented Aug 17, 2022

@tokers yes, i will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants