You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/09 06:33:45 UTC

[GitHub] [apisix] yunduansing opened a new issue, #8285: help request: how to rewrite upstream response

yunduansing opened a new issue, #8285:
URL: https://github.com/apache/apisix/issues/8285

   ### Description
   
   1.upstream body may response:
   `{
      "data": [],
     "total": 100
   }
   `
   http status code: 200
   
   **then I want to rewrite it like :** 
   `{
      "data":{ "data": [],"total": 100} ,
      "errcode": 0
   }
   `
   http status code: 200
   
   2.upstream body may response:
   `
   "Internal error."
   `
   http status code: 500
   
   **then I want to rewrite it like :** 
   `{
      "msg": "Internal error.",
      "errcode": 500,
      "data": null
   }
   `
   http status code: 200
   
   I want to know how to do it when I use the default response-rewrite plugin
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - 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`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Hazel6869 commented on issue #8285: help request: how to rewrite upstream response

Posted by GitBox <gi...@apache.org>.
Hazel6869 commented on issue #8285:
URL: https://github.com/apache/apisix/issues/8285#issuecomment-1308294470

   @yunduansing Hi,you can use responese-rewrite plugin, refer to https://apisix.apache.org/zh/docs/apisix/plugins/response-rewrite/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] yunduansing commented on issue #8285: help request: how to rewrite upstream response

Posted by GitBox <gi...@apache.org>.
yunduansing commented on issue #8285:
URL: https://github.com/apache/apisix/issues/8285#issuecomment-1308300483

   > @yunduansing Hi,you can use responese-rewrite plugin, refer to https://apisix.apache.org/zh/docs/apisix/plugins/response-rewrite/ I can give you an example.
   
   nice! please give me ur example ths.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] yunduansing closed issue #8285: help request: how to rewrite upstream response

Posted by GitBox <gi...@apache.org>.
yunduansing closed issue #8285: help request: how to rewrite upstream response 
URL: https://github.com/apache/apisix/issues/8285


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Hazel6869 commented on issue #8285: help request: how to rewrite upstream response

Posted by GitBox <gi...@apache.org>.
Hazel6869 commented on issue #8285:
URL: https://github.com/apache/apisix/issues/8285#issuecomment-1308366066

   @yunduansing you can use this function 
   ![image](https://user-images.githubusercontent.com/30279880/200774203-ef69d13f-c749-4c5f-b82c-0afe62d72c96.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org