Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Add ability to set TTL depending URL/Headers/Cookies #66

Open
darkweak opened this issue Apr 16, 2021 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@darkweak
Copy link
Owner

darkweak commented Apr 16, 2021

We want to be able to define the cache TTL depending either one of URL, Headers or Cookies or every ones at the same time.
We could replace the MatchedURL object to another one, like CacheKey with the following structure

type CacheKey struct {
    type  string (eg."headers"|"cookies")
    regex string
}

Or another one with a priority field

type CacheKey struct {
    url      string (eg."/^.+$/")
    cookies  string (eg."/^.+$/")
    priority int
}

Then the YAML could be one of

cache_keys:
  - type: headers
    regex: '/^.+$/'
  - type: cookies
    regex: '/^.+$/'
  - type: headers
    regex: '/^[A-z]+$/'
cache_keys:
  - cookies: '/^.+$/'
    priority: 1
  - url: '/^.+$/'
    priority: 40
  - url: '/nothing$/'
    cookies: '/^Auth.+$/'
    priority: 999
@darkweak darkweak added the enhancement New feature or request label Apr 25, 2021
@darkweak darkweak added the Next release It will be in the next release label Jun 20, 2021
@darkweak darkweak removed Next release It will be in the next release hacktoberfest labels Dec 11, 2021
@mattvb91
Copy link

I was just about to open a new issue asking if my headers are being ignored from the upstream as it seems to only ever use the config ttl setting and just seen this.

Big thumbs up for this as our backend controls all the caching times through the Cache-Control header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants