<div dir="ltr">Thanks, that worked perfectly for now.<div><br></div><div>Jeff</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 November 2014 08:57, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You just return the original conduit, but set the headers in the wrapper class itself.<br>
<span class="im HOEnZb"><br>
Stuart<br>
<br>
----- Original Message -----<br>
> From: "Jeff Williams" <<a href="mailto:jeffw@wherethebitsroam.com">jeffw@wherethebitsroam.com</a>><br>
</span><div class="HOEnZb"><div class="h5">> To: "Stuart Douglas" <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> Cc: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> Sent: Monday, 3 November, 2014 6:34:28 PM<br>
> Subject: Re: [undertow-dev] Changing headers on proxy response<br>
><br>
> Stuart,<br>
><br>
> Thanks for that. I'm guessing I can just extend<br>
> org.xnio.conduits.AbstractStreamSinkConduit<StreamSinkConduit> and just<br>
> pass everything through to next? Since there is not much information around<br>
> about the StreamSinkConduit, where would be the best place to add the<br>
> headers? In the first call to one of the transferFrom methods?<br>
><br>
> I've added a JIRA for this: <a href="https://issues.jboss.org/browse/UNDERTOW-340" target="_blank">https://issues.jboss.org/browse/UNDERTOW-340</a><br>
><br>
> Regards,<br>
> Jeff<br>
><br>
> On 2 November 2014 04:24, Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>> wrote:<br>
><br>
> > You can set them in a response wrapper<br>
> > (io.undertow.server.HttpServerExchange#addResponseWrapper) and they should<br>
> > 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<br>
> > proxy.<br>
> ><br>
> > Stuart<br>
> ><br>
> > ----- Original Message -----<br>
> > > From: "Jeff Williams" <<a href="mailto:jeffw@wherethebitsroam.com">jeffw@wherethebitsroam.com</a>><br>
> > > To: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> > > Sent: Saturday, 1 November, 2014 12:43:38 AM<br>
> > > Subject: [undertow-dev] Changing headers on proxy response<br>
> > ><br>
> > > Hi,<br>
> > ><br>
> > > I am currently using a customer handler wrapping the proxy handler. I<br>
> > want to<br>
> > > set some response headers from my handler, but if they exist in the<br>
> > response<br>
> > > from the proxy's backend, they are overridden. Example code:<br>
> > ><br>
> > > Undertow.builder()<br>
> > > .addHttpListener(8080, "localhost")<br>
> > > .setHandler(new MyHandler(new ProxyHandler(proxy, 30000,<br>
> > ResponseCodeHandler.<br>
> > > HANDLE_404 ))).build();<br>
> > ><br>
> > > class MyHandler extends HttpHandler {<br>
> > > private static final HttpString ACCESS_CONTROL_EXPOSE_HEADERS = new<br>
> > > HttpString("Access-Control-Expose-Headers");<br>
> > > private HTTPHandler next;<br>
> > > public MyHandler(HttpHandler next) {<br>
> > > this.next = next;<br>
> > > }<br>
> > > p ublic void handleRequest(HttpServerExchange exchange ) throws<br>
> > Exception {<br>
> > > exchange .getResponseHeaders().put( ACCESS_CONTROL_EXPOSE_HEADERS , " new<br>
> > > ACEH" );<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > The problem here is that the backend server responds with an<br>
> > > Access-Control-Expose-Headers header and that replaces the one I set in<br>
> > > MyHandler.<br>
> > ><br>
> > > Is there any way I can change headers after proxy has received the<br>
> > response<br>
> > > from backend and before it starts sending the response to the client?<br>
> > ><br>
> > > Regards,<br>
> > > Jeff<br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > undertow-dev mailing list<br>
> > > <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> > > <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
> ><br>
><br>
</div></div></blockquote></div><br></div>