How to... - how to use variable in sub_filter and SSI?


From “how to use variable in sub_filter and SSI?” at

I’m a newbie to nginx.

I want to use a cookie varaible to change a string in html body.


      set $path "";
      if ($http_cookie ~ "path=([^;]+)(?:;|$)") {
           set  $path  $1;
      sub_filter pp $path;


     <!--#include file="/static/pp/test.html" -->

It can work with static string such as abc. But when I change it to a
variable,it output errors:


unexpected “abc” symbol after “/static/” value of “file” parameter in
“include” SSI command while sending response to client…

Does there anyone know how to use it?

Thanks in advance!

Posted by newbie