Skip to content

Can not flush cache #140

@sylloger

Description

@sylloger

caddy version: 1.11.2

$ curl -v -X PURGE http://localhost:2019/souin-api/souin/flush
* Host localhost:2019 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:2019...
* Connected to localhost (::1) port 2019
* using HTTP/1.x
> PURGE /souin-api/souin/flush HTTP/1.1
> Host: localhost:2019
> User-Agent: curl/8.14.1
> Accept: */*
> 
* Request completely sent off
* Empty reply from server
* shutting down connection #0
curl: (52) Empty reply from server

log

{"level":"info","ts":1773995888.740839,"logger":"admin.api","msg":"received request","method":"PURGE","host":"localhost:2019","uri":"/souin-api/souin/flush","remote_ip":"10.88.0.112","remote_port":"54338","headers":{"Accept":["*/*"],"User-Agent":["curl/8.14.1"]}}
{"level":"info","ts":1773995888.7425144,"msg":"http: panic serving 10.88.0.112:54338: runtime error: invalid memory address or nil pointer dereference\ngoroutine 2663 [running]:\nnet/http.(*conn).serve.func1()\n\tnet/http/server.go:1907 +0xbd\npanic({0x1c7bd00?, 0x37542c0?})\n\truntime/panic.go:860 +0x13a\ngithub.com/darkweak/souin/pkg/api.(*SouinAPI).HandleRequest(0x2514e81b5020, {0x23581f0, 0x2514e9083110}, 0x2514e8130140)\n\tgithub.com/darkweak/souin@v1.7.7/pkg/api/souin.go:316 +0x931\ngithub.com/caddyserver/cache-handler.(*adminAPI).handleAPIEndpoints(0x2514e8643050?, {0x23581f0, 0x2514e9083110}, 0x2514e8130140)\n\tgithub.com/caddyserver/cache-handler@v0.16.0/admin.go:41 +0xf2\ngithub.com/caddyserver/caddy/v2.AdminHandlerFunc.ServeHTTP(0x425234?, {0x23581f0?, 0x2514e9083110?}, 0x2514e925aab0?)\n\tgithub.com/caddyserver/caddy/v2@v2.11.2/admin.go:1360 +0x29\ngithub.com/caddyserver/caddy/v2.(*AdminConfig).newAdminHandler.(*AdminConfig).newAdminHandler.func2.func6({0x23581f0, 0x2514e9083110}, 0x2514e8130140)\n\tgithub.com/caddyserver/caddy/v2@v2.11.2/admin.go:248 +0x7b\nnet/http.HandlerFunc.ServeHTTP(0x2358580?, {0x23581f0?, 0x2514e9083110?}, 0x2514e860b750?)\n\tnet/http/server.go:2286 +0x29\ngithub.com/caddyserver/caddy/v2.(*AdminConfig).newAdminHandler.func1.instrumentHandlerCounter.1({0x2358580?, 0x2514e82fe5a0?}, 0x2514e8130140)\n\tgithub.com/caddyserver/caddy/v2@v2.11.2/metrics.go:56 +0x6f\nnet/http.HandlerFunc.ServeHTTP(0x2514e927e3c0?, {0x2358580?, 0x2514e82fe5a0?}, 0x74c47f?)\n\tnet/http/server.go:2286 +0x29\nnet/http.(*ServeMux).ServeHTTP(0x2514e8640f90?, {0x2358580, 0x2514e82fe5a0}, 0x2514e8130140)\n\tnet/http/server.go:2828 +0x1c7\ngithub.com/caddyserver/caddy/v2.adminHandler.serveHTTP({0x2514e927e3c0, 0x0, 0x0, {0x2514e7e86528, 0x1, 0x1}, 0x0}, {0x2358580, 0x2514e82fe5a0}, 0x2514e8130140)\n\tgithub.com/caddyserver/caddy/v2@v2.11.2/admin.go:891 +0x793\ngithub.com/caddyserver/caddy/v2.adminHandler.ServeHTTP({0x2514e927e3c0, 0x0, 0x0, {0x2514e7e86528, 0x1, 0x1}, 0x0}, {0x2358580, 0x2514e82fe5a0}, 0x2514e8130140)\n\tgithub.com/caddyserver/caddy/v2@v2.11.2/admin.go:816 +0x7a5\nnet/http.serverHandler.ServeHTTP({0x2514e829d180?}, {0x2358580?, 0x2514e82fe5a0?}, 0x1?)\n\tnet/http/server.go:3311 +0x8e\nnet/http.(*conn).serve(0x2514e925aa20, {0x235da70, 0x2514e85e1380})\n\tnet/http/server.go:2073 +0x650\ncreated by net/http.(*Server).Serve in goroutine 2372\n\tnet/http/server.go:3464 +0x485"}

Caddyfile

{
	debug
	order cache before rewrite

	cache {
		api {
			souin
		}
	}
}

example.com {
    @cacheable {
        not path /
    }
    handle @cacheable {
        cache {
            ttl 120s
        }
    }

    file_server
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions