Archive for category http

Unable to apply Javascript XSL Transform over HTTPS

I came across this issue a while a go and couldn’t really find much information on it at the time so thought that I would post about it just in case anyone has a similar issue.

We had the following code that loads an XML document and then applies a XSL transform against the XML document. The code looks a bit like following:
(This is the IE Specific version)

xmlDoc = new ActiveXObject(‘Msxml2.DOMDocument.3.0’);
xmlDoc.loadXML(XMLString);
xslDoc = new ActiveXObject(‘Msxml2.DOMDocument.3.0’);
xslDoc.load(xslFile);
output = xmlDoc.transformNode(xslDoc);

We would normally run this over HTTP and it always applied the transform and generated our output as you would expect. When we ran the same code over HTTPS the transform would never work.

After a lot of investigation it turned out that the issue was being caused due to a cache setting in the response header.

We were setting the Cache-Control parameter in the Response header to

‘private,no-cache,no-store’.

It seems that not allowing the XSL form to be cached was preventing the ActiveObject from loading it for the transform. By removing Cache-control parameter from the response header it worked fine every time.
Hope this can save someone with the same issue a bit of time.

1 Comment