krakend / krakend-ce

KrakenD Community Edition: High-performance, stateless, declarative, API Gateway written in Go.
https://www.krakend.io
Apache License 2.0
1.94k stars 453 forks source link

Vary header mechanism #868

Open basaran opened 6 months ago

basaran commented 6 months ago

Environment info:

Version: 2.6.0 Linux 6.7.7-1-MANJARO x86_64

Describe what are you trying to do: I have a request header which limits the number of records returned from an API. I need to have Krakend pay attention to the Vary header.

To be on the safe side, I added Vary to the allowed headers.

      "allow_headers": [
        "Origin",
        "Authorization",
        "Content-Type",
        "Cache-Control",
        "prefer",
        "Vary"
      ],

I sent my request with the following headers:

Content-Type: application/x-www-form-urlencoded
User-Agent: insomnium/0.2.3-a
Cache-Control: max-age=604800
prefer: maxpagesize=10
Vary: prefer

When I change the value of the maxpagesize, I still hit the same cache. To be on the safe side, I also tried:

Content-Type: application/x-www-form-urlencoded
User-Agent: insomnium/0.2.3-a
Cache-Control: max-age=604800
prefer: maxpagesize=10
Vary: *

According to MDN, the asterisk implies cache should not be returned.