Closed palant closed 1 day ago
When the handler wants to add its own module however (helps remove some work-arounds I’ve added before), this option is rather suboptimal.
Actually, I can see now that the module list is no longer mutable during early_request_filter
, so adding modules isn’t even possible there. Hooking into the server initialization is really the only way.
You can access and mutate the modules here. Be this PR also provides a nicer API.
let mut proxy = http_proxy_service(...);
proxy.app_logic_mut().unwrap().downstream_modules
You can access and mutate the modules here.
I know. As I said, doing this via some code outside the handler is possible but a significant logic break.
We've brought this into main as dda7bec58cb176228b8194e97c8c9e52bf36b878. Thanks!
This addresses a roadblock I’ve hit trying to make the new downstream modules mechanism work for me: these cannot be configured from within the
HttpProxy
instance. The configuration has to happen afterhttp_proxy_service
has been called, but at this point theHttpProxy
instance has been moved into the service and is no longer accessible. In order to adjust the compression level for example some code outside the actual handler would have to mess with the service configuration which is a significant logic break.In case of compression this can be addressed by adjusting compression level in
early_request_filter
. When the handler wants to add its own module however (helps remove some work-arounds I’ve added before), this option is rather suboptimal.So I’ve added an
init_downstream_module
phase whereHttpProxy
can adjust modules to its liking.