0

I am using Varnish 4.1.2, and trying to include ESI content. Sometimes, the URL for the included content might include encoded HTML entities, such as ' (').

For example, I have the following in the HTML returned by my app for the outer shell:

<esi:include src="/esi/map/alice&#x27;s%20house"/>

This should result in an ESI request for a path with 3 segments and no query string, which when fully decoded, result in:

  • esi
  • map
  • alice's house

The apostrophe in the third segment is HTML encoded because it is being transmitted in an HTML document. The space is URL encoded because it is part of a URL.

However, Varnish seems to not decode the HTML encoded entity before making the ESI request. It sends a request for /esi/map/alice&#x27;s%20house, which is a bad request, because & is not legal in the path or a URL.

How can I get Varnish to handle these ESI links properly?

pkaeding
  • 36,513
  • 30
  • 103
  • 141

1 Answers1

0

I ended up posting this question on the Varnish Github issue tracker, and it seems the answer is: you can't.

The workaround is to URL-encode the link, to avoid the need for using HTML entities.

pkaeding
  • 36,513
  • 30
  • 103
  • 141