Hi Chris,
this is a very common use case for LittleProxy. Trust me and start with
https://github.com/ganskef/LittleProxy/blob/master/README.md. Consider
to clone the current SNAPSHOT version.
With org.littleshoot.proxy.HttpProxyServerBootstrap:
For 1. use 80 instead of 8080 in withPort(int)
For 2. use withChainProxyManager() with:
ChainedProxyManager chainProxyManager = new ChainedProxyManager() {
public void lookupChainedProxies(HttpRequest httpRequest,
Queue<ChainedProxy> chainedProxies) {
chainedProxies.add(new ChainedProxyAdapter() {
@Override
public InetSocketAddress getChainedProxyAddress() {
return new InetSocketAddress("localhost", 8080);
}
});
chainedProxies.add(ChainedProxyAdapter.FALLBACK_TO_DIRECT_CONNECTION);
}
};
For 3. in your Filter (extends HttpFiltersAdapter) for example:
@Override
public HttpResponse clientToProxyRequest(HttpObject httpObject) {
if (httpObject instanceof HttpRequest) {
HttpRequest request = (HttpRequest) httpObject;
HttpHeaders headers = request.headers();
headers.remove(HttpHeaders.Names.IF_MODIFIED_SINCE);
headers.remove(HttpHeaders.Names.IF_NONE_MATCH);
}
return null;
}
It's only the beginning... Have fun. But, pay attention on Java Non
Blocking IO and the derived concepts in Netty. This is important, I think.
Regards Frank
Am 13.06.2015 um 13:30 schrieb
chris....@gmail.com:
>
> I want to use little proxy so that it:
>
> 1.
>
> Listens on port 80
>
> 2.
>
> Forwards request to Tomcat on port 8080.
>
> 3.
>
> Allows me to add header fields before forwarding to port 8080.
>
> I have not been able to find any examples online that do this sort of
> thing. Can someone point me to some code/examples that would do this/ Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "LittleProxy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
littleproxy...@googlegroups.com
> <mailto:
littleproxy...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.