trickster icon indicating copy to clipboard operation
trickster copied to clipboard

Response get not cached - Status is alway kmiss

Open ch9hn opened this issue 2 years ago • 0 comments

Hello, I have the problem, that one of the REST APIs I want to cache, is always failing and the REDIS Key is always deleted.

Logs:

trickster  | time=x app=trickster level=debug event="redis cache remove" key=demo.host.opc.6af458366efc65dde25ba9f9f7ffa1bc caller=cache/redis/redis.go:129
trickster  | time=2022-05-29T23:04:22.057896626Z app=trickster level=debug event="redis cache miss" key=demo.host.opc.6af458366efc65dde25ba9f9f7ffa1bc caller=cache/redis/redis.go:117
trickster  | time=2022-05-29T23:04:22.268980668Z app=trickster level=debug event="redis cache remove" key=demo.host.opc.6af458366efc65dde25ba9f9f7ffa1bc caller=cache/redis/redis.go:129
trickster  | time=2022-05-29T23:04:23.177295418Z app=trickster level=debug event="redis cache miss" key=demo.host.opc.6af458366efc65dde25ba9f9f7ffa1bc caller=cache/redis/redis.go:117

Headers of demo.host.com backend - not working:

> HEAD /vdl/<LONGURL> HTTP/1.1
> Host: 127.0.0.1:8480
> User-Agent: curl/7.79.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=UTF-8
Content-Type: application/json; charset=UTF-8
< Date: x GMT
Date: x GMT
< X-Trickster-Result: engine=ObjectProxyCache; status=kmiss
X-Trickster-Result: engine=ObjectProxyCache; status=kmiss
config.yaml

Working API:

*   Trying 127.0.0.1:8480...
* Connected to 127.0.0.1 (127.0.0.1) port 8480 (#0)
> HEAD /plos/search?q=DNA HTTP/1.1
> Host: 127.0.0.1:8480
> User-Agent: curl/7.79.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
< Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Access-Control-Max-Age: 1728000
Access-Control-Max-Age: 1728000
< Connection: keep-alive
Connection: keep-alive
< Content-Type: application/json;charset=utf-8
Content-Type: application/json;charset=utf-8
< Etag: "XXX"
Etag: "XXX"
< Last-Modified: x GMT
Last-Modified: xGMT
< Strict-Transport-Security: max-age=15724800; includeSubDomains
Strict-Transport-Security: max-age=15724800; includeSubDomains
< X-Cache-Status: MISS
X-Cache-Status: MISS
< X-Trickster-Result: engine=ObjectProxyCache; status=hit
X-Trickster-Result: engine=ObjectProxyCache; status=hit
< Date: xGMT
Date: x GMT

Trickster config.yaml

frontend:
  listen_port: 8480

request_rewriters:
  remove-cache-control:
    instructions: [
      ['header', 'delete', 'Cache-Control', 'no-store'],
      ['header', 'delete', 'Cache-Control', 'no-cache'],
      ['header', 'delete', 'Pragma'],
    ]


backends:
  vvdl:
    hosts: [ demo.host.com ]
    origin_url: https://demo.host.com
    provider: reverseproxycache
    cache_name: rds
    req_rewriter_name: remove-cache-control


# This API is working
  plos:
    hosts: [ api.plos.org ]
    origin_url: https://api.plos.org
    provider: reverseproxycache
    cache_name: rds
    forwarded_headers: standard
   req_rewriter_name: remove-cache-control


metrics:
 listen_port: 8481   # available for scraping at http://<trickster>:<metrics.listen_port>/metrics

logging:
  log_level: DEBUG

caches:
  rds:
    provider: redis
    redis:
      client_type: standard
      protocol: tcp
      endpoint: 'redis:6379'
      db: 0
      password: "XXX"

Do you have an idea - what wrong here ?

ch9hn avatar May 29 '22 23:05 ch9hn