0

In a Nginx working as a proxy, I need to set the "Cache-Control" header on a response based on the size defined on their "content-length".

For example, if the response have "150" or less, "Cache-Control" must be "max-age=60", if not, "max-age=3600"

# curl -I 127.0.0.1/test_small.png
HTTP/1.1 200 
content-type: image/png
cache-control: max-age=60
content-length: 106
# curl -I 127.0.0.1/test_big.png
HTTP/1.1 200 
content-type: image/png
cache-control: max-age=3600
content-length: 250

Maybe it can be done easily if the content-lenght is a fixed value?

rfmoz
  • 772
  • 9
  • 15

0 Answers0