Overwrite Zuul's connection header Keep-Alive
<p>I have following applications:
Gateway-Service 
Api-Service</p>

<p>Gateway-Serivce is Zuul proxy and Api-Service is basically rest + broker + websocket + other thechnologies.</p>

<p>I'm using sockjs + stomp to communicate with broker through zuul. For doing protocol upgrade socket handler need to have <strong>connection</strong> header set to <strong>Upgrade</strong>. When I request this on gateway this connection header is set to Upgrade but after the zuul processing header is set to <strong>Keep-Alive</strong>. 
So first question is if it's ok to replace connection header with original request header and if it's ok then how to do that? Using some Zuul filter?</p>

<p>Thanks</p>

<p>for someone interested this could be the solution...all credits goes to @spencergibb</p>

<pre><code>@Component
public static class WebSocketHeaderFilter extends ZuulFilter {

    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 0;
    }

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        RequestWrapper wrapper = new RequestWrapper(ctx.getRequest());
        String upgradeHeader = wrapper.getHeader("Upgrade");
        if (null == upgradeHeader) {
            upgradeHeader = wrapper.getHeader("upgrade");
        }
        if (null != upgradeHeader &amp;&amp; "websocket".equalsIgnoreCase(upgradeHeader)) {
            wrapper.addHeader("connection", "Upgrade");
            ctx.addZuulRequestHeader("connection", "Upgrade");
            ctx.setRequest(wrapper);
        }
        return null;
    }
}
</code></pre>