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/01/21 02:15:22 UTC

[GitHub] [apisix] davidwhf opened a new issue #6175: request help: api-breaker plugin donot work

davidwhf opened a new issue #6175:
URL: https://github.com/apache/apisix/issues/6175


   ### Issue description
   
   ```.sh
   curl http://127.0.0.1:9080/apisix/admin/routes/1 \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT \
   -d '
   {
       "plugins": {
           "api-breaker": {
               "break_response_code": 502,
               "unhealthy": {
                   "http_statuses": [503],
                   "failures": 2
               },
               "healthy": {
                   "http_statuses": [200],
                   "successes": 1
               }
           }
       },
       "uri": "/test/*"
   }'
   curl -i http://127.0.0.1:9080/test/index.html
   curl -i http://127.0.0.1:9080/test/index.html
   curl -i http://127.0.0.1:9080/test/index.html
   ```
   I execute command curl three times, it still return 503,not 502.
   ```.html
   HTTP/1.1 503 Service Temporarily Unavailable
   Date: Fri, 21 Jan 2022 01:55:21 GMT
   Content-Type: text/html; charset=utf-8
   Content-Length: 194
   Connection: keep-alive
   Server: APISIX/2.11.0
   
   <html>
   <head><title>503 Service Temporarily Unavailable</title></head>
   <body>
   <center><h1>503 Service Temporarily Unavailable</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   ```
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.11.0
   - OS (cmd: `uname -a`): Linux 5d9c3c92e8b1 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 Linux
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): 
   nginx version: openresty/1.19.3.2
   built by gcc 9.3.0 (Alpine 9.3.0) 
   built with OpenSSL 1.1.1g  21 Apr 2020
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_BASE_VER=1.19.3.2.2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.9 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -Wl,-rpath,/usr/local/openresty/wasmtime-c-api
 /lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --add-module=/tmp/tmp.Po19j8606M/openresty-1.19.3.2/../mod_dubbo --add-module=/tmp/tmp.Po19j8606M/openresty-1.19.3.2/../ngx_multi_upstream_module --add-module=/tmp/tmp.Po19j8606M/openresty-1.19.3.2/../apisix-nginx-module --add-module=/tmp/tmp.Po19j8606M/openresty-1.19.3.2/../wasm-nginx-module --add-module=/tmp/tmp.Po19j8606M/openresty-1.19.3.2/../lua-var-nginx-module --with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_stati
 c_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-http_ssl_module
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   etcdctl version: 3.4.15
   API version: 3.4
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `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

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



[GitHub] [apisix] spacewander closed issue #6175: request help: api-breaker plugin donot work

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #6175:
URL: https://github.com/apache/apisix/issues/6175


   


-- 
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] bisakhmondal commented on issue #6175: request help: api-breaker plugin donot work

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


   > In fact, I refer to the example of official documents.
   see as https://apisix.apache.org/zh/docs/apisix/plugins/api-breaker/
   503 is an http error code that the resource cannot be found. Therefore, although upstream is not configured, the http request return 503.
   
   Hi as @starsz pointed out, the error is due to missing upstream configuration. If you open the logs/error.log you will see an entry there,
   > 2022/01/25 02:06:08 [error] 3128311#3128311: *3394 [lua] init.lua:520: http_access_phase(): failed to set upstream: missing upstream configuration in Route or Service, client: 127.0.0.1, server: _, request: "GET /test/index.html HTTP/1.1", host: "127.0.0.1:9080"
   
   Due to security reasons, we don't throw elaborate error messages along with HTTP status codes during request-response lifecycle. The 503 you are seeing is not the one you may have configured (if) inside your api-breaker schema. It's from the apisix internal component following the semantic HTTP response codes when it hits an error
   > The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle the request.
   
   Feel free to test it with the configuration @starsz shared, you will get something like
   ```
   curl -i http://127.0.0.1:9080/test/index.html     
   
   HTTP/1.1 502 Bad Gateway
   Date: Mon, 24 Jan 2022 20:39:22 GMT
   Content-Type: text/html; charset=utf-8
   Content-Length: 154
   Connection: keep-alive
   Server: APISIX/2.11.0
   X-APISIX-Upstream-Status: 502
   
   <html>
   <head><title>502 Bad Gateway</title></head>
   <body>
   <center><h1>502 Bad Gateway</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   
   ```
   
   Hope, this solves your concern. 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] bisakhmondal commented on issue #6175: request help: api-breaker plugin donot work

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


   > In fact, I refer to the example of official documents.
   see as https://apisix.apache.org/zh/docs/apisix/plugins/api-breaker/
   503 is an http error code that the resource cannot be found. Therefore, although upstream is not configured, the http request return 503.
   
   Hi as @starsz pointed out, the error is due to missing upstream configuration. If you open the logs/error.log you will see an entry there,
   > 2022/01/25 02:06:08 [error] 3128311#3128311: *3394 [lua] init.lua:520: http_access_phase(): failed to set upstream: missing upstream configuration in Route or Service, client: 127.0.0.1, server: _, request: "GET /test/index.html HTTP/1.1", host: "127.0.0.1:9080"
   
   Due to security reasons, we don't throw elaborate error messages along with HTTP status codes during request-response lifecycle. The 503 you are seeing is not the one you may have configured (if) inside your api-breaker schema. It's from the apisix internal component following the semantic HTTP response codes when it hits an error
   > The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle the request.
   
   Feel free to test it with the configuration @starsz shared, you will get something like
   ```
   curl -i http://127.0.0.1:9080/test/index.html     
   
   HTTP/1.1 502 Bad Gateway
   Date: Mon, 24 Jan 2022 20:39:22 GMT
   Content-Type: text/html; charset=utf-8
   Content-Length: 154
   Connection: keep-alive
   Server: APISIX/2.11.0
   X-APISIX-Upstream-Status: 502
   
   <html>
   <head><title>502 Bad Gateway</title></head>
   <body>
   <center><h1>502 Bad Gateway</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   
   ```
   
   Hope, this solves your concern. 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 #6175: request help: api-breaker plugin donot work

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


   @davidwhf would you like to submit a PR to improve the documentation?


-- 
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 #6175: request help: api-breaker plugin donot work

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


   @davidwhf would you like to submit a PR to improve the documentation?


-- 
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] zaunist commented on issue #6175: request help: api-breaker plugin donot work

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


   HI, @davidwhf . Is your upstream healthy? Please provide more detail and reproduce steps.


-- 
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] starsz commented on issue #6175: request help: api-breaker plugin donot work

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


   Hi, @davidwhf.
   I think you should config the upstream (even if a bad upstream) so that it can work well.
   
   You can try this:
   
   ```
   {
       "plugins": {
           "api-breaker": {
               "break_response_code": 502,
               "unhealthy": {
                   "http_statuses": [503],
                   "failures": 2
               },
               "healthy": {
                   "http_statuses": [200],
                   "successes": 1
               }
           }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:3333": 1
           }
       },
       "uri": "/test/*"
   }
   ```
   


-- 
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] davidwhf commented on issue #6175: request help: api-breaker plugin donot work

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


   > Hi, @davidwhf. I think you should config the upstream (even if a bad upstream) so that it can work well.
   > 
   > You can try this:
   > 
   > ```
   > {
   >     "plugins": {
   >         "api-breaker": {
   >             "break_response_code": 502,
   >             "unhealthy": {
   >                 "http_statuses": [503],
   >                 "failures": 2
   >             },
   >             "healthy": {
   >                 "http_statuses": [200],
   >                 "successes": 1
   >             }
   >         }
   >     },
   >     "upstream": {
   >         "type": "roundrobin",
   >         "nodes": {
   >             "127.0.0.1:3333": 1
   >         }
   >     },
   >     "uri": "/test/*"
   > }
   > ```
   
   In fact, I refer to the example of official documents.
   see as https://apisix.apache.org/zh/docs/apisix/plugins/api-breaker/
   503 is an http error code that the resource cannot be found. Therefore, although upstream is not configured, the http request return 503.


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