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

From “how to use variable in sub_filter and SSI?” at
http://forum.nginx.org/showthread.php?t=12


I’m a newbie to nginx.

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

nginx.conf

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

html

   <head>
     <!--#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:

HTML:

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