Open kausality opened 7 years ago
We do this in a in clientToProxyRequest method like this:
getClientCtx().attr(ORIGIN_ADDRESS).setIfAbsent(getIpForRequest(httpObject));
Then you can get it in other filter like this:
getClientCtx().attr(ORIGIN_ADDRESS).get()
Thanks for this information @michalsvec
Is there a default implementation of getClientCtx() which returns the current channel context in every class or do I have to modify LP's code and add a ChannelInboundHandler to save all active channels in a list or map?
After reading the code, I found out that HttpFiltersSource.filterRequest also gets the ChannelHandlerContext in its arguments. This was not mentioned in the outdated docs I was using.
It would be great if the Client Channel Context is also passed in ChainedProxyManager.lookupChangedProxies since in many cases, proxies will be selected on the basis of Client-side stateful information.
Hi,
I have a specific use case where we need to do the filtering based on the client IP in HttpFiltersAdapter. Client IP is available in ActivityTracker.clientConnected. As per my knowledge, LittleProxy doesn't have any method to share objects which are request specific. So it seems impossible for me to pass around the client IP or any other context-specific object from one class to another.
I thought of using a static map which can hold references whose keys are based on the client IP and Port. But since I cannot access the client IP in another class, I cannot deference.
Any suggestions on how to solve this?