Not able to connect Mqtt Broker through proxy

I am trying to connect to Mqtt Broker (Ignition broker module) through corporate proxy, I am getting below error while executing client.connect(); call. Mqtt broker is running on my local. I also tried to connect mqtt broker running on a remote machine, but got same error as below. Quick help in this regard is highly aprreciated.
Error : com.hivemq.client.mqtt.exceptions.MqttDecodeException: Exception while decoding PUBACK: fixed header flags must be 0 but were 8

MqttProxyConfig mqttProxyConfig = MqttProxyConfig.builder()
            .address(new InetSocketAddress($PROXY_HOST, 80)).protocol(proxyProtocol).build();
MqttClientTransportConfig config = MqttClientTransportConfig.builder()
        .proxyConfig(mqttProxyConfig).serverHost("localhost").serverPort(1883) .build();


Mqtt3BlockingClient client = Mqtt3Client.builder()
        .identifier(clientId)
        .serverHost("localhost")
        .serverPort(1883)
        .transportConfig(config)
         .simpleAuth().username(mqttBrokerUser).password(mqttBrokerConfigPassword.getBytes()).applySimpleAuth()
            .buildBlocking();
      

client.connect();
client.toBlocking().publishWith().topic(topic).qos(MqttQos.AT_MOST_ONCE).payload(jsonPayload.getBytes()).send();

Hi @roshasha

The error you’re encountering, MqttDecodeException: Exception while decoding PUBACK: fixed header flags must be 0 but were 8, suggests that there is an issue with the way the MQTT client is handling the PUBACK message during communication with the broker.

The flags in the fixed header of the PUBACK message should be 0, and the fact that it shows 8 indicates that something in the communication process is likely misconfigured.

Here are a few things to check and consider for resolving this issue:

  • The serverHost("localhost") and serverPort(1883) might be causing the issue if you’re running the broker in a different environment. Verify that localhost is indeed the correct address, especially when connecting through a proxy.

  • If your network path includes additional proxies, firewalls, or other network devices, ensure they are not interfering with the MQTT traffic, such as modifying or blocking PUBACK packets. It’s important that the proxy is transparent to MQTT messages.

If none of these approaches help, you may need to check the logs of the proxy server.

I hope this helps!

Best,
Dasha from The HiveMQ Team