FRiCKLE/ngx_cache_purge

curl -vvv -X PURGE -I URL returns HTTP/1.1 404 Not Found

kaushalshriyan opened this issue · 0 comments

I have added the below line in main context of nginx.conf file.
The location of the module file :- /etc/nginx/modules/ngx_http_cache_purge_module.so

load_module modules/ngx_http_cache_purge_module.so;


#cat /etc/nginx/nginx.conf
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;
load_module modules/ngx_http_cache_purge_module.so;

events {
    worker_connections  1024;
}
[nginxpurgecache.conf.txt](https://github.com/FRiCKLE/ngx_cache_purge/files/8646811/nginxpurgecache.conf.txt)


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

# nginx -t -c /etc/nginx/nginx.conf
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
#
the nginx cache has the contents which are as follows. 

# pwd
/var/www/nginx/cache
#
# ls -l
total 0
drwxrwxrwx. 14 nginx deployuser 114 May  8 05:58 content
drwxrwxrwx. 15 nginx deployuser 123 May  8 07:31 files
#
/var/www/nginx/cache/files
# ls -l
total 0
drwx------ 4 nginx nginx 26 May  8 05:58 0
drwx------ 4 nginx nginx 26 May  8 06:04 1
drwx------ 5 nginx nginx 36 May  8 05:58 2
drwx------ 3 nginx nginx 16 May  6 12:12 3
drwx------ 4 nginx nginx 26 May  8 05:58 4
drwx------ 3 nginx nginx 16 May  8 06:04 6
drwx------ 3 nginx nginx 16 May  8 06:04 7
drwx------ 3 nginx nginx 16 May  5 10:44 9
drwx------ 3 nginx nginx 16 May  5 10:44 a
drwx------ 3 nginx nginx 16 May  8 06:04 b
drwx------ 3 nginx nginx 16 May  8 07:31 d
drwx------ 4 nginx nginx 26 May  8 06:04 e
drwx------ 3 nginx nginx 16 May  5 11:29 f
# cd ../content/
# ls -l
total 0
drwx------ 3 nginx nginx 16 May  6 05:28 1
drwx------ 5 nginx nginx 36 May  8 11:39 2
drwx------ 3 nginx nginx 16 May  6 12:12 3
drwx------ 3 nginx nginx 16 May  8 05:58 4
drwx------ 6 nginx nginx 46 May  5 08:03 5
drwx------ 6 nginx nginx 46 May  8 07:31 7
drwx------ 4 nginx nginx 26 May  5 08:03 8
drwx------ 3 nginx nginx 16 May  4 17:21 9
drwx------ 4 nginx nginx 26 May  8 06:04 a
drwx------ 5 nginx nginx 36 May  8 06:30 c
drwx------ 3 nginx nginx 16 May  5 06:21 d
drwx------ 4 nginx nginx 26 May  5 08:03 f
#

#curl -vvv -X PURGE -I https://testnginxproxycachepurge.testintcraft.com/apis
* About to connect() to [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/) port 443 (#0)
*   Trying 34.105.141.181...
* Connected to [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/) (34.105.141.181) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=[testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/)
* start date: Apr 26 11:06:35 2022 GMT
* expire date: Jul 25 11:06:34 2022 GMT
* common name: [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/)
* issuer: CN=R3,O=Let's Encrypt,C=US
> PURGE /apis HTTP/1.1
> User-Agent: curl/7.29.0
> Host: [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/)
> Accept: */*
>
< HTTP/1.1 404 Not Found
HTTP/1.1 404 Not Found
< Server: nginx/1.20.2
Server: nginx/1.20.2
< Date: Sun, 08 May 2022 08:01:55 GMT
Date: Sun, 08 May 2022 08:01:55 GMT
< Content-Type: text/html
Content-Type: text/html
< Content-Length: 153
Content-Length: 153
< Connection: keep-alive
Connection: keep-alive

<
* Excess found in a non pipelined read: excess = 153 url = /apis (zero-length body)
* Connection #0 to host [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/) left intact

200 OK
#curl -vvv -X GET -I https://testnginxproxycachepurge.testintcraft.com/apis
* About to connect() to [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/) port 443 (#0)
*   Trying 34.105.141.181...
* Connected to [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/) (34.105.141.181) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=[testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/)
* start date: Apr 26 11:06:35 2022 GMT
* expire date: Jul 25 11:06:34 2022 GMT
* common name: [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/)
* issuer: CN=R3,O=Let's Encrypt,C=US
> GET /apis HTTP/1.1
> User-Agent: curl/7.29.0
> Host: [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/)
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: nginx/1.20.2
Server: nginx/1.20.2
< Date: Sun, 08 May 2022 08:01:43 GMT
Date: Sun, 08 May 2022 08:01:43 GMT
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Connection: keep-alive
Connection: keep-alive
< Cache-Control: max-age=21600, public
Cache-Control: max-age=21600, public
< Link: <https://testnginxproxycachepurge.testintcraft.com/apis>; rel="canonical"
Link: <https://testnginxproxycachepurge.testintcraft.com/apis>; rel="canonical"
< X-UA-Compatible: IE=edge
X-UA-Compatible: IE=edge
< Content-language: en
Content-language: en
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Permissions-Policy: interest-cohort=()
Permissions-Policy: interest-cohort=()
< Expires: Sun, 19 Nov 1978 05:00:00 GMT
Expires: Sun, 19 Nov 1978 05:00:00 GMT
< Vary: Cookie
Vary: Cookie
< X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubDomains
< Set-Cookie: ADRUM_BT=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
Set-Cookie: ADRUM_BT=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
< Set-Cookie: ADRUM_BT=R%3A53%7Cg%3A5277dd0a-8de6-440a-a8f7-52fb782db251139%7Cn%3Aicebergtest_e1c60ae6-5d00-47d5-8c0a-690d8465795f; expires=Sun, 08-May-2022 05:58:56 GMT; Max-Age=30; path=/
Set-Cookie: ADRUM_BT=R%3A53%7Cg%3A5277dd0a-8de6-440a-a8f7-52fb782db251139%7Cn%3Aicebergtest_e1c60ae6-5d00-47d5-8c0a-690d8465795f; expires=Sun, 08-May-2022 05:58:56 GMT; Max-Age=30; path=/
< Last-Modified: Tue, 26 Apr 2022 14:39:40 GMT
Last-Modified: Tue, 26 Apr 2022 14:39:40 GMT
< ETag: "1650983980"
ETag: "1650983980"
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< X-Cache-Status: HIT
X-Cache-Status: HIT

<
* Excess found in a non pipelined read: excess = 15395 url = /apis (zero-length body)
* Connection #0 to host [testnginxproxycachepurge.testintcraft.com](http://testnginxproxycachepurge.testintcraft.com/) left intact
#

Please guide me. Thanks in advance.