Question

I would like to store the result of an ESI include or eval block in an ESI variable. The contents of the include is outside of my control. Its format is JSON. I've tried all of the following to no avail. The variable ends up as an empty string.

<esi:assign name="variable_name">
'<esi:include src="$(url)" method="post" entity="$(param)" />'
</esi:assign>
<esi:assign name="variable_name">
'<esi:eval src="$(url)" method="post" entity="$(param)" />'
</esi:assign>

<esi:assign name="variable_name">
'''<esi:include src="$(url)" method="post" entity="$(param)" />'''
</esi:assign>
<esi:assign name="variable_name">
'''<esi:eval src="$(url)" method="post" entity="$(param)" />'''
</esi:assign>

The ESI server I'm testing on is Akamai's ETS.

Was it helpful?

Solution

This is the solution as provided by Akamai's support team. Quite convoluted, but it works wonderfully.


File: json.txt

{ "a" : 1, "b" : 2 }

File: frag.esi

<esi:text><esi:assign name="val">'''</esi:text><esi:include
src="json.txt"/><esi:text>'''</esi:assign></esi:text>

File: container.esi

<esi:eval src="frag.esi" dca="esi" />

<esi:vars>
val = $(val)
</esi:vars>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top