How to dynamically enable/disable HTTP proxy configuration based on a YAML property?
04:50 07 Aug 2026

I would like to enable or disable an HTTP proxy dynamically based on a YAML property.

service:
  useHttpProxy: "true"

HTTP Request Config:


    


I get the following error:

Unable to convert 'proxyConfig' with class 'java.lang.String'
to class 'HttpProxyConfig'
WriterExecutionException:
Unable to convert 'proxyConfig' with class 'java.lang.String'
to class 'HttpProxyConfig'

My understanding is that the proxyConfig attribute expects an HttpProxyConfig object, while my expression returns a String ("proxyConfig").

Questions:

  1. Is it possible to dynamically set the proxyConfig attribute using a DataWeave expression?

  2. If not, what is the recommended Mule 4 approach for enabling/disabling proxy usage via a YAML property?

  3. Do I need two separate http:request-config definitions (one with a proxy and one without) and select the appropriate one at runtime?

enter image description here

advice mulesoft