Discourse stripping ESI tag when adding custom footer


(Yarn Holt) #1

We use Varnish to serve a common header and footer for our site using ESI tags. These look something like:

<esi:include src="http://www.xyz.abc/esi_parts/footer" />

When discourse serveres the page back to Varnish it will inject the content into the page. However when we customize our theme (using the editor within the admin panel) and add the line above to the footer then on page load we see in the page source that its converted the above to:

<include src="http://www.xyz.abc/esi_parts/footer"></include>

Or sometimes (it seems random) it doesn’t show up in the page source at all.

Is there some parser that is mangling/removing it and if so how can we disable it or workaround it?


(Sam Saffron) #2

This is going to be too late, footer is dynamically added so any mangling your varnish wants to do will happen too late.

You are going to have to figure out a different solution here.


(Yarn Holt) #3

Thanks but how is that possible since Varnish sits in front of Discourse and serves the page to the browser. So varnish requests the page from Discourse and once received it can cache it if necessary and also inject ESI’s and other things. How can discourse prevent that? (other than by refusing to allow the esi:include tag in the markup)


(Sam Saffron) #4

The footer is passed to the SPA as a JSON blob.

So unless you teach varnish how to fiddle with the json you are not going to have any luck there.


(Yarn Holt) #5

Ah got it, thanks Sam!


(system) #6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.