<div dir="ltr"><div><i>ngx.print()</i> is only valid for r<i>ewrite_by_lua*, access_by_lua* and content_by_lua*.</i> Maybe your looking for<i> print()<br><br>ngx.log</i> should work though<i>.<br></i></div><br><div><div><i><br>
</i></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/20 Ramesh Muraleedharan <span dir="ltr"><<a href="mailto:ramesh1987@gmail.com" target="_blank">ramesh1987@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I've been experimenting with rewriting 'Set Cookie' headers in a nginx-reverse-proxy effort.</div>
<div><br></div><div>The Set-Cookie rewrite doesn't seem to work yet, and more importantly, my log/print statements don't print to error_log as directed, making it very difficult to debug.</div>
<div><br></div><div><div>http {</div><div><br></div><div>server {</div><div> access_log /home/bhedia/access.log;</div><div> #error_log /home/bhedia/errors.log debug;</div><div> error_log /home/bhedia/errors.log notice;</div>
<div><br></div><div> listen 80;</div><div><br></div><div> root /usr/share/nginx/www;</div><div> #index index.html index.htm;</div><div><br></div><div> # Make site accessible from <a href="http://localhost:8080/" target="_blank">http://localhost:8080/</a></div>
<div> server_name localhost;</div><div><br></div><div> location / {</div><div><br></div><div> proxy_pass <a href="http://10.45.17.85:50088/" target="_blank">http://10.45.17.85:50088/</a>;</div>
<div> proxy_set_header Host <a href="http://booga.booga.com" target="_blank">booga.booga.com</a>;</div>
<div> #proxy_cookie_domain <a href="http://test-sites.com" target="_blank">test-sites.com</a> <a href="http://booga.booga.com" target="_blank">booga.booga.com</a>;</div><div> </div><div> header_filter_by_lua '</div>
<div>
<span style="white-space:pre-wrap"> </span> ngx.log(ngx.NOTICE, "hello world")</div><div> local cookies = ngx.header.set_cookie</div><div> if not cookies then return end</div>
<div> if type(cookies) ~= "table" then cookies = {cookies} end</div><div> local newcookies = {}</div><div> for i, val in ipairs(cookies) do</div><div> local newval = string.gsub(val, "([dD]omain)=[%w_-\\\\.-]+",</div>
<div> "%1=<a href="http://booga.booga.com" target="_blank">booga.booga.com</a>")</div><div><span style="white-space:pre-wrap"> </span> ngx.print(val)</div><div><span style="white-space:pre-wrap"> </span> ngx.print(newval)</div>
<div> table.insert(newcookies, newval)</div><div> end</div><div> ngx.header.set_cookie = newcookies</div><div> ';</div><div> }</div><div>}</div><div>}</div>
<div><br></div><div>Any help would be appreciated.</div><div><br></div><div>Thanks!</div></div></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div>