0

How to set the Content-Lenght header or any other header for images? I need it to set a rule in the varnish to not cache images larger than 500kb.

  • 2
    Images aren't generally served by Drupal so this is actually probably to do with your web server configuration. You might also consider asking in a group for Varnish whether your strategy is a good idea or not. – Alfred Armstrong Apr 20 '13 at 16:27
  • Thanks Alfred. Maybe oryginal images no, but I think the images generated by the styles are served by drupal, see from D7.20 how tokens added to the addresses of images, preventing DoS. I need it because a large number of large images clog varnish memory. Solution at the moment - I've added a rule to return pipe based on path to larger styles size. – malcolm Apr 21 '13 at 14:42
  • 1
    Derivative images are generated by Drupal when first referenced, then served by the web server subsequently. So I guess your question does apply when the derivative is first generated, though I'd be surprised if you have many derivatives over 500K, so you could probably just cache them without checking the length. – Alfred Armstrong Apr 21 '13 at 15:57
  • Thanks, yes I have lots of images over 500kb (desktop walpapers with many sizes), ok I'll look at webserver configuration (hiawatha 9.0), thank You ;) – malcolm Apr 21 '13 at 16:15
  • My god, my webserver actually set Content-Lenght headers, I missed it because the varnish cache... my bad, time to relax :) Thank You ;) – malcolm Apr 21 '13 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.