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/05/17 02:56:23 UTC

[GitHub] [apisix] mygrsun opened a new issue, #7056: help request: is there any way to get the upstream error in the plugin?

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

   ### Description
   
   i want to get the upstream timeout error  in the plugin.beacuse i want to sent a json resonse to caller when the upstream is timeout.for example :
   {"Response":{"RequestId":"123","Error":{"Message":"upstream timeout"}}}
   
   ### 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] soulbird commented on issue #7056: help request: is there any way to get the upstream error in the plugin?

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

   It looks like you can only get a 502 status code in Apache APISIX. Maybe you can use [get_logs](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#get_logs) function to extract relevant information from the error log to determine `reset` or `timeout`, etc. I have not tested it, not sure if it is feasible.


-- 
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] mygrsun commented on issue #7056: help request: is there any way to get the upstream error in the plugin?

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

   > you can use this plugin: https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/response-rewrite.md
   > 
   > the config maybe:
   > 
   > ```json
   > {
   >                     "plugins": {
   >                         "response-rewrite": {
   >                             "body": "{\"code\":\"ok\",\"message\":\"new json body\"}",
   >                             "status_code": 502,
   >                             "vars": [
   >                                 ["status","==",502]
   >                             ]
   >                         }
   >                     },
   >                     "upstream": {
   >                         "nodes": {
   >                             "127.0.0.1:1980": 1
   >                         },
   >                         "type": "roundrobin"
   >                     },
   >                     "uri": "/hello"
   >                 }
   > ```
   > 
   > just an example, please read the plugin document.
   
   thank you


-- 
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] tzssangglass commented on issue #7056: help request: is there any way to get the upstream error in the plugin?

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

   you can use this plugin: https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/response-rewrite.md
   
   the config maybe:
   
   ```json
   {
                       "plugins": {
                           "response-rewrite": {
                               "body": "{\"code\":\"ok\",\"message\":\"new json body\"}",
                               "status_code": 502,
                               "vars": [
                                   ["status","==",502]
                               ]
                           }
                       },
                       "upstream": {
                           "nodes": {
                               "127.0.0.1:1980": 1
                           },
                           "type": "roundrobin"
                       },
                       "uri": "/hello"
                   }
   ```
   
   just an example, please read the plugin document.


-- 
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] spacewander closed issue #7056: help request: is there any way to get the upstream error in the plugin?

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #7056: help request: is there any way to get the upstream error in the plugin?
URL: https://github.com/apache/apisix/issues/7056


-- 
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