How to upstream request set header based on SSI variable?

Jan Algermissen algermissen1971 at
Wed Dec 7 20:02:39 UTC 2016


I have setup SSI to include responses from upstream services.

I am trying to find a way to set additional headers for these upstream 
requests based on a variable set in the SSI page but I am not sure if 
that even works at all.

Does someone know *if* this is doable and if so, how?

In config I have

server {
   set $etag "xxxxx";

   location /up1/ {
     proxy_set_header If-Match $etag;
     proxy_pass http://upstream1/up1/;

<!--# set var="etag" value="123456" -->
<!--# include virtual="/up1/this/is/requested/from/upstream" -->

This sends an

    If-Match: xxxxx

header to the upstream, but what I want to achieve is to send the 
"123456" instead.

I'd also be glad for suggestions what I might try to get this to work.


More information about the nginx mailing list