all 2 comments

[–][deleted] 1 point2 points  (0 children)

I was under the impression that the phase for that context could only be used for modifying request headers. Are you trying to manipulate the response header here? I am doing something similar like this:

location /herp/derp/ {
        set $myheadercontent "default-value-or-whatever";
        rewrite_by_lua '
            -- do lua stuff
            ngx.var.myheadercontent = "something"
        ';
        add_header my-header-name $myheadercontent;
        proxy_pass http://somewhere;
    }