Skip to content

Commit

Permalink
Disable X-Forwarded-For evaluation (WE ARE THE PROXY)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyind committed May 13, 2017
1 parent 879099a commit e7f9875
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/main/java/net/talpidae/viceroy/ViceroyApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ public void run()
// disable jersey framework (we are just a proxy, for now)
serverConfig.setJerseyResourcePackages(new String[0]);

val proxyHandler = new CanonicalPathHandler(new ProxyHandler(proxyClient, 30000, ResponseCodeHandler.HANDLE_404));
serverConfig.getAdditionalHandlers().add(proxyHandler);
// proxying is all we do
serverConfig.setRootHandlerWrapper(handler -> new CanonicalPathHandler(new ProxyHandler(proxyClient, 30000, ResponseCodeHandler.HANDLE_404)));

// TODO Config SSL certs
// TODO Make this configurable via command line (--server.port)
serverConfig.setPort(443);

// make sure we don't accept X-Forwarded-For and such headers
serverConfig.setBehindProxy(false);

try
{
server.start();
Expand Down

0 comments on commit e7f9875

Please sign in to comment.