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)
|
protected void addRequestProxyHeaders(Stream stream, Headers headers)
|
||||||
{
|
{
|
||||||
addViaHeader(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)
|
protected void addResponseProxyHeaders(Stream stream, Headers headers)
|
||||||
|
|
|
@ -59,13 +59,14 @@ public class ProxyHTTPSPDYAsyncConnection extends AsyncHttpConnection
|
||||||
private Stream stream;
|
private Stream stream;
|
||||||
private Buffer content;
|
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.version = version;
|
||||||
this.proxyEngine = proxyEngine;
|
this.proxyEngine = proxyEngine;
|
||||||
this.generator = (HttpGenerator)_generator;
|
this.generator = (HttpGenerator)_generator;
|
||||||
this.session = new HTTPSession(version, connector);
|
this.session = new HTTPSession(version, connector);
|
||||||
|
this.session.setAttribute("org.eclipse.jetty.spdy.remoteAddress", endPoint.getRemoteAddr());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class ServerSPDYAsyncConnectionFactory implements AsyncConnectionFactory
|
||||||
FlowControlStrategy flowControlStrategy = connector.newFlowControlStrategy(version);
|
FlowControlStrategy flowControlStrategy = connector.newFlowControlStrategy(version);
|
||||||
|
|
||||||
StandardSession session = new StandardSession(version, bufferPool, threadPool, scheduler, connection, connection, 2, listener, generator, flowControlStrategy);
|
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());
|
session.setWindowSize(connector.getInitialWindowSize());
|
||||||
parser.addListener(session);
|
parser.addListener(session);
|
||||||
connection.setSession(session);
|
connection.setSession(session);
|
||||||
|
|
Loading…
Reference in New Issue