darkweak / souin

An HTTP cache system, RFC compliant, compatible with @tyktechnologies, @traefik, @caddyserver, @go-chi, @bnkamalesh, @beego, @devfeel, @labstack, @gofiber, @go-goyave, @go-kratos, @gin-gonic, @roadrunner-server, @zalando, @zeromicro, @nginx and @apache

Home Page:https://docs.souin.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cache_keys order

frederichoule opened this issue · comments

In what order cache_keys are handled?

I am trying to achieve:

  • /.*: disable_query true
  • /?something=1: disable_query false

I tried with this configuration, but it doesn't work:

cache_keys {
	".*" {
		disable_query true
	}
	".*\?something=1$" {
		disable_query false
	}
}

Well, I thought I had tried it, but just switching them works, since there's a break as soon as it finds a match. https://github.com/darkweak/souin/blob/master/context/key.go

I am reopening this since #331 will fix it.

So yes I had switched the keys and it worked, but it had other unexpected consequences. I switched to matchers in Caddy instead of cache_keys, but as soon as released I'll try again and see if there are any more bugs.

You can already try it using xcaddy build --with gitHub.com/darkweak/souin/plugins/caddy@${HASH} --with gitHub.com/darkweak/souin@${HASH} where hash is the commit hash

Yes, already using another commit that way. I will still wait for the release for this one :-) Thanks @darkweak !