<div dir="ltr">Stuart,<div><br></div><div>Thanks for that. I&#39;m guessing I can just extend org.xnio.conduits.AbstractStreamSinkConduit&lt;StreamSinkConduit&gt; and just pass everything through to next? Since there is not much information around about the StreamSinkConduit, where would be the best place to add the headers? In the first call to one of the transferFrom methods?</div><div><br></div><div>I&#39;ve added a JIRA for this: <a href="https://issues.jboss.org/browse/UNDERTOW-340">https://issues.jboss.org/browse/UNDERTOW-340</a></div><div><br></div><div>Regards,</div><div>Jeff</div>







</div><div class="gmail_extra"><br><div class="gmail_quote">On 2 November 2014 04:24, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can set them in a response wrapper (io.undertow.server.HttpServerExchange#addResponseWrapper) and they should not be overriden, although this is not ideal.<br>
<br>
If you file a JIRA I will look at adding better support for this into the proxy.<br>
<br>
Stuart<br>
<span class=""><br>
----- Original Message -----<br>
&gt; From: &quot;Jeff Williams&quot; &lt;<a href="mailto:jeffw@wherethebitsroam.com">jeffw@wherethebitsroam.com</a>&gt;<br>
&gt; To: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
&gt; Sent: Saturday, 1 November, 2014 12:43:38 AM<br>
&gt; Subject: [undertow-dev] Changing headers on proxy response<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I am currently using a customer handler wrapping the proxy handler. I want to<br>
&gt; set some response headers from my handler, but if they exist in the response<br>
&gt; from the proxy&#39;s backend, they are overridden. Example code:<br>
&gt;<br>
&gt; Undertow.builder()<br>
&gt; .addHttpListener(8080, &quot;localhost&quot;)<br>
&gt; .setHandler(new MyHandler(new ProxyHandler(proxy, 30000, ResponseCodeHandler.<br>
&gt; HANDLE_404 ))).build();<br>
&gt;<br>
&gt; class MyHandler extends HttpHandler {<br>
&gt; private static final HttpString ACCESS_CONTROL_EXPOSE_HEADERS = new<br>
&gt; HttpString(&quot;Access-Control-Expose-Headers&quot;);<br>
&gt; private HTTPHandler next;<br>
&gt; public MyHandler(HttpHandler next) {<br>
&gt; this.next = next;<br>
&gt; }<br>
&gt; p ublic void handleRequest(HttpServerExchange exchange ) throws Exception {<br>
</span>&gt; exchange .getResponseHeaders().put( ACCESS_CONTROL_EXPOSE_HEADERS , &quot; new<br>
<span class="">&gt; ACEH&quot; );<br>
&gt; }<br>
&gt; }<br>
&gt;<br>
&gt; The problem here is that the backend server responds with an<br>
&gt; Access-Control-Expose-Headers header and that replaces the one I set in<br>
&gt; MyHandler.<br>
&gt;<br>
&gt; Is there any way I can change headers after proxy has received the response<br>
&gt; from backend and before it starts sending the response to the client?<br>
&gt;<br>
&gt; Regards,<br>
&gt; Jeff<br>
&gt;<br>
&gt;<br>
</span>&gt; _______________________________________________<br>
&gt; undertow-dev mailing list<br>
&gt; <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
</blockquote></div><br></div>