Added support for X-Forwarded-For header.
This commit is contained in:
parent
a7dab4bd2d
commit
1843324bab
|
@ -73,6 +73,9 @@ public abstract class ProxyEngine extends ServerSessionFrameListener.Adapter imp
|
|||
protected void addRequestProxyHeaders(Stream stream, Headers headers)
|
||||
{
|
||||
addViaHeader(headers);
|
||||
String address = (String)stream.getSession().getAttribute("org.eclipse.jetty.spdy.remoteAddress");
|
||||
if (address != null)
|
||||
headers.add("X-Forwarded-For", address);
|
||||
}
|
||||
|
||||
protected void addResponseProxyHeaders(Stream stream, Headers headers)
|
||||
|
|
|
@ -59,13 +59,14 @@ public class ProxyHTTPSPDYAsyncConnection extends AsyncHttpConnection
|
|||
private Stream stream;
|
||||
private Buffer content;
|
||||
|
||||
public ProxyHTTPSPDYAsyncConnection(SPDYServerConnector connector, EndPoint endpoint, short version, ProxyEngine proxyEngine)
|
||||
public ProxyHTTPSPDYAsyncConnection(SPDYServerConnector connector, EndPoint endPoint, short version, ProxyEngine proxyEngine)
|
||||
{
|
||||
super(connector, endpoint, connector.getServer());
|
||||
super(connector, endPoint, connector.getServer());
|
||||
this.version = version;
|
||||
this.proxyEngine = proxyEngine;
|
||||
this.generator = (HttpGenerator)_generator;
|
||||
this.session = new HTTPSession(version, connector);
|
||||
this.session.setAttribute("org.eclipse.jetty.spdy.remoteAddress", endPoint.getRemoteAddr());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,6 +69,7 @@ public class ServerSPDYAsyncConnectionFactory implements AsyncConnectionFactory
|
|||
FlowControlStrategy flowControlStrategy = connector.newFlowControlStrategy(version);
|
||||
|
||||
StandardSession session = new StandardSession(version, bufferPool, threadPool, scheduler, connection, connection, 2, listener, generator, flowControlStrategy);
|
||||
session.setAttribute("org.eclipse.jetty.spdy.remoteAddress", endPoint.getRemoteAddr());
|
||||
session.setWindowSize(connector.getInitialWindowSize());
|
||||
parser.addListener(session);
|
||||
connection.setSession(session);
|
||||
|
|
Loading…
Reference in New Issue