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/03/31 14:46:03 UTC

[GitHub] [apisix] fatihbm opened a new issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

fatihbm opened a new issue #6766:
URL: https://github.com/apache/apisix/issues/6766


   ### Current Behavior
   
   When I want to purge to cache I got an "HTTP 404 Not Found" error. 
   When I looked a little bit, I saw that the purge method did not work when I only allowed the GET and HEAD methods as the HTTP method. I agree, this is normal behavior. 
   But the PURGE method is not supported by API or interface. I realized that I should choose ALL as the HTTP method instead. 
   In short, the HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.
   
   Ps.sorry about that I'm not sure if this is a bug or a new feature maybe both.
   
   ### Expected Behavior
   
   The PURGE method should be supported within the HTTP method options.
   
   ### Error Logs
   
   ```
   $ curl http://10.61.11.4:9080/hello?cache=2222 -H "Host: test.example.com" -X PURGE -v
   *   Trying 10.61.11.4:9080...
   * TCP_NODELAY set
   * Connected to 10.61.11.4 (10.61.11.4) port 9080 (#0)
   > PURGE /hello?cache=2222 HTTP/1.1
   > Host: test.example.com
   > User-Agent: curl/7.68.0
   > Accept: */*
   >
   * Mark bundle as not supporting multiuse
   < HTTP/1.1 404 Not Found
   < Date: Thu, 31 Mar 2022 14:27:06 GMT
   < Content-Type: text/plain; charset=utf-8
   < Transfer-Encoding: chunked
   < Connection: keep-alive
   <
   {"error_msg":"404 Route Not Found"}
   * Connection #0 to host 10.61.11.4 left intact
   
   ### Steps to Reproduce
   
   The error reproduces when the PURGE method is called in a configuration that does not have ALL selected as the HTTP method.
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.11.0
   - Operating system (run `uname -a`): ` Linux mt-tap6-linlb03 5.4.0-97-generic #110~18.04.1-Ubuntu SMP Mon Jan 17 20:50:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux `
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): `nginx version: openresty/1.19.9.1
   built with OpenSSL 1.1.1k  25 Mar 2021 (running with OpenSSL 1.1.1l  24 Aug 2021)
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -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.20 --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.10 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/loc
 al/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --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_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-stream --with-http_ssl_module`
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): `{"id":"aa24eed2-fb04-4e43-ad54-daa26c44e429","version":"2.11.0","etcd_version":"3.4.0","up_time":18802,"last_report_time":1648737880,"hostname":"mt-tap6-linlb03","boot_time":1648719100}`
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`): `/usr/local/bin/luarocks 3.8.0`
   


-- 
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] soulbird commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   Did you create route to `/hello`? Could you provide detailed steps to reproduce?


-- 
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 #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   


-- 
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] tokers commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   Yes, `PURGE` is not in the method enumeration list.


-- 
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] soulbird commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   Did you create a route to `/hello` ? Could you provide the complete reproduction 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] soulbird commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   Below are my steps to reproduce and it works fine:
   
   step 1: create route with proxy_cache plugin
   ```bash
   curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "plugins": {
           "proxy-cache": {
               "cache_key":  ["$uri", "-cache-id"],
               "cache_method": ["GET"],
               "cache_http_status": [200],
               "hide_cache_headers": true
           }
       },
       "upstream": {
           "scheme": "https",
           "nodes": {
               "180.96.32.88:443": 1
           },
           "type": "roundrobin"
       },
       "uri": "/202108/*"
   }'
   ```
   
   step 2: request
   ```bash
   curl -v http://127.0.0.1:9080/202108/weibo.png -H"host:static.apiseven.com"
   *   Trying 127.0.0.1:9080...
   * Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
   > GET /202108/weibo.png HTTP/1.1
   > Host:static.apiseven.com
   > User-Agent: curl/7.77.0
   > Accept: */*
   > 
   * Mark bundle as not supporting multiuse
   < HTTP/1.1 200 OK
   < Content-Type: image/png
   < Content-Length: 531926
   < Connection: keep-alive
   < Date: Fri, 01 Apr 2022 01:06:00 GMT
   < X-NWS-UUID-VERIFY: 962bbd19632fc179e12596ec219aafa1
   < X-Daa-Tunnel: hop_count=2
   < X-Cache-Lookup: Hit From Upstream
   < X-Cache-Lookup: Hit From Disktank3
   < ETag: "78c81aa9cd5718740181610bc8d34d7c"
   < x-cos-hash-crc64ecma: 7033376303200969310
   < x-cos-request-id: NjE2N2JmYTVfYTAzNTQwMGJfMTI0YWRfODNiODYz
   < X-Cache-Lookup: Hit From Inner Cluster
   < Last-Modified: Mon, 16 Aug 2021 15:38:03 GMT
   < X-NWS-LOG-UUID: 3078069757058418945
   < X-Cache-Lookup: Cache Miss
   < Server: APISIX/2.13.0
   < Apisix-Cache-Status: HIT
   < Accept-Ranges: bytes
   < 
   ......
   ````
   
   step 3: purge
   ```bash
   curl -v http://127.0.0.1:9080/202108/weibo.png -H"host:static.apiseven.com" -XPURGE
   *   Trying 127.0.0.1:9080...
   * Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
   > PURGE /202108/weibo.png HTTP/1.1
   > Host:static.apiseven.com
   > User-Agent: curl/7.77.0
   > Accept: */*
   > 
   * Mark bundle as not supporting multiuse
   < HTTP/1.1 200 OK
   < Date: Fri, 01 Apr 2022 01:07:57 GMT
   < Content-Type: image/png
   < Transfer-Encoding: chunked
   < Connection: keep-alive
   < Server: APISIX/2.13.0
   
   ```
   


-- 
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] soulbird removed a comment on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

Posted by GitBox <gi...@apache.org>.
soulbird removed a comment on issue #6766:
URL: https://github.com/apache/apisix/issues/6766#issuecomment-1085273386


   Did you create a route to `/hello` ? Could you provide the complete reproduction 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] fatihbm commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   > Did you create route to `/hello`? Could you provide detailed steps to reproduce?
   
   Yes, sure. You can see on any route configuration with proxy cache enable. Just a need http method configuration that does not have ALL selected.


-- 
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] soulbird commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   @fatihbm Thank you!We will support the `PURGE` method.


-- 
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] fatihbm commented on issue #6766: bug: The HTTP method must be selected as ALL to use the PURGE function during the use of the proxy cache.

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


   it's normal behavior because if `methods` is not specified while creating the route, by default `ALL` is selected. Sorry, I guess I didn't explain the reproduce properly.  Can you retry step one, as in the example below?
   
   ``` 
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT \
   -d '{
       "methods": [
           "GET",
           "HEAD"
       ],
       "plugins": {
           "proxy-cache": {
               "cache_key":  ["$uri", "-cache-id"],
               "cache_method": ["GET"],
               "cache_http_status": [200],
               "hide_cache_headers": true
           }
       },
       "upstream": {
           "scheme": "https",
           "nodes": {
               "180.96.32.88:443": 1
           },
           "type": "roundrobin"
       },
       "uri": "/202108/*"
   }'  
   ```
   
   ![image](https://user-images.githubusercontent.com/4369033/161215700-7a96b645-9f78-4b34-9a7b-858ad16755a2.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