Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2342

Make image from URL abide no-cache HTTP headers

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: image/unqualified
    • Environment:
      Tested on CentOS, Tomcat6 and FOP 1.1rc1 service

      Description

      When I include an image, it is cached. So including a dynamic image shows only the first version of the image. To prevent this, I have to add a constantly changing parameter (called "nonce" here):

      <fo:external-graphic width="140mm" height="30mm" content-width="scale-down-to-fit" content-height="scale-down-to-fit" inline-progression-dimension.maximum="100%" scaling="uniform" vertical-align="-50%">
      <xsl:variable name="orgguid" select="Organization/ID" />
      <xsl:variable name="nonce" select="Nonce" />
      <xsl:variable name="logo" select="concat('http://localhost/images/fopimages/logo.php?orgid=', $orgguid, '&dummy=', $nonce)"/>
      <xsl:attribute name="src">url(<xsl:value-of select="$logo"/>)</xsl:attribute>
      </fo:external-graphic>

      This happens despite the fact that the PHP script that produces the image sends "no-cache" headers (PHP code):

      header('Expires: Fri, 13 May 1983 18:30:00 GMT');
      header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
      header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
      header('Cache-Control: post-check=0, pre-check=0', FALSE);
      header('Pragma: no-cache'); // HTTP/1.0
      header('Content-Type: ' . $this->mstrLogoType);
      header('Content-Length: ' . strlen($this->mmixLogoData));
      header('Content-Disposition: inline');
      header('X-Content-Type-Options: nosniff'); // Workaround for IE bug.
      echo $this->mmixLogoData;

      It would be nice if the image caching mechanism would abide these headers, so workarounds like extra parameters are not necessary.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Bitsmith The BitSmith
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: