envoyproxy / envoyproxy/envoy

The cache demo returns 503 when the cached response is no longer valid

Open
#29,105 2 comments 0 reactions 0 assignees View on GitHub
area/cache area/examples bug help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Title*: The [cache demo](https://www.envoyproxy.io/docs/envoy/v1.27.0/start/sandboxes/cache) returns 503 when the cached response is no longer valid

*Description*:
The demo works fine as long as the response is either not cached or the cached response is still valid. Once the cached answer times out or requires validation, Envoy replies with 503.

*Repro steps*:
Follow the instructions from the [documentation](https://www.envoyproxy.io/docs/envoy/v1.27.0/start/sandboxes/cache):
```
$ cd examples/cache
$ docker compose pull
$ docker compose up --build -d
```
The no-cache example is a good demonstrator of this behaviour:
```
$ curl -i localhost:8000/service/1/no-cache
HTTP/1.1 200 OK
content-type: text/plain; charset=utf-8
cache-control: max-age=0, no-cache
etag: "1621f3c428db2d63d351830b17508da8bfabfca0"
content-length: 125
date: Thu, 17 Aug 2023 14:13:24 GMT
server: envoy
x-envoy-upstream-service-time: 1

This response can be cached, but it has to be validated on each request
Response generated at: Thu, 17 Aug 2023 14:13:24 GMT

$ curl -i localhost:8000/service/1/no-cache
HTTP/1.1 503 Service Unavailable
content-length: 95
content-type: text/plain
date: Thu, 17 Aug 2023 14:13:24 GMT
server: envoy

upstream connect error or disconnect/reset before headers. reset reason: connection termination%
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.