On Wed, Jun 8, 2011 at 3:02 PM, tobia <span dir="ltr">&lt;<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">António P. P. Almeida Wrote:<br>
&gt; &gt; How can I rewrite the content of the Set-Cookie<br>
&gt; &gt; response headers, replacing &quot;;Domain=<a href="http://backend.int" target="_blank">backend.int</a>&quot;<br>
&gt; &gt; with &quot;;Domain=<a href="http://external.domain.com" target="_blank">external.domain.com</a>&quot;?<br>
&gt;<br>
&gt; AFAIK you&#39;ll need to use 3rd party modules. Either<br>
&gt; <a href="http://wiki.nginx.org/HttpHeadersMoreModule" target="_blank">http://wiki.nginx.org/HttpHeadersMoreModule</a> and/or<br>
&gt; <a href="http://github.com/chaoslawful/lua-nginx-module" target="_blank">http://github.com/chaoslawful/lua-nginx-module</a><br>
&gt;<br>
&gt; Probably the Embedded Perl module let&#39;s you do<br>
&gt; that also. You&#39;ll have to try it out.<br>
<br>
</div>Thanks for the pointers.<br>
<br>
HttpHeadersMoreModule doesn&#39;t seem to let me replace parts of headers.<br>
<br>
Lua doesn&#39;t seem to have it either:<br>
&gt; Reading values from ngx.header.HEADER is not<br>
&gt; implemented yet, and usually you shouldn&#39;t need it.<br><br></blockquote><div>I think you need to read the headers you get back from ngx.location.capture in Lua (retrieve the backend response), then set the outbound headers with ngx.HEADER, so you should be able to do this in Lua.</div>
<div><br></div><div>So your content_by_lua block calls ngx.location.capture to get the backend response, reads the headers it gets from there, then sets the outbound headers....</div><div><br></div><div>Justin</div><div> </div>
</div>