You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RabbitMQ address configuration properties don't support percent-encoded values in the URI #52623
A common way to configure RabbitMQ is to take the URI provided by the platform or a secret store and pass it straight through, for example SPRING_RABBITMQ_ADDRESSES=${RABBITMQ_URL}. That works as long as the URI contains no percent-encoded characters. When it does, Boot uses the encoded values as they are, while RabbitMQ decodes them as the AMQP URI spec describes:
Address
Spring Boot
RabbitMQ
amqp://user:secret@localhost:5672/%2F
vhost %2F
vhost /
amqp://user:p%40ss@localhost:5672/vh
password p%40ss
password p@ss
amqp://us%3Aer:secret@localhost:5672/my%2Fvhost
user us%3Aer, vhost my%2Fvhost
user us:er, vhost my/vhost
So a URI that the RabbitMQ client accepts fails to authenticate, or connects to the wrong virtual host, with Boot. For example, if a generated password contains a symbol like @ or /, or if the default / virtual host is written as %2F.
Setting username, password and virtual-host separately works around it, but that means splitting a URI that should work as is.
I checked this on 4.1.2 using RabbitProperties.determinePassword() and determineVirtualHost(), which feed the auto-configured connection details. From reading the code, the new AMQP 1.0 support in 4.2 (PropertiesAmqpRabbitConnectionDetails) parses spring.amqp.rabbitmq.address the same way.
I found the issue #3328 where it is discussed about reworking how addresses are handled, but this doesn't need that. Decoding the values after they've been parsed should be enough, and it only changes anything for addresses that contain %. Happy to send a PR if that sounds reasonable.
changed the title [-]spring.rabbitmq.addresses doesn't decode percent-encoded credentials or virtual host[/-][+]RabbitMQ address configuration properties don't support percent-encoded values[/+]on Nov 6, 2026
changed the title [-]RabbitMQ address configuration properties don't support percent-encoded values[/-][+]RabbitMQ address configuration properties don't support percent-encoded values in the URI[/+]on Nov 6, 2026
For addresses with an explicit port, RabbitUri now decodes the username, password and virtual host with URLDecoder. That decoder handles HTML form data and turns + into a space. A literal + is valid in those parts of an AMQP URI, and RabbitMQ’s ConnectionFactory.setUri preserves it.
With spring.rabbitmq.addresses=amqp://app:[email protected]:5672/orders, Boot 4.0.9, 4.1.2 and 4.2.0-RC2 use pa+ss. The 4.0.10-SNAPSHOT, 4.1.3-SNAPSHOT and 4.2.0-SNAPSHOT builds tested on November 6 use pa ss.
RabbitPropertiesproperties = newRabbitProperties();
properties.setAddresses(List.of("amqp://app:[email protected]:5672/orders"));
System.out.println(properties.determinePassword()); // 4.0.9: pa+ss, 4.0.10-SNAPSHOT: pa ss
Against a local AMQP test broker configured with pa+ss, the @RabbitListener application started on 4.0.9 and failed authentication on 4.0.10-SNAPSHOT:
Using StringUtils.uriDecode preserves literal + and still decodes percent escapes, as in #50650. The second copy of RabbitUri on main, in spring-boot-amqp-rabbitmq for spring.amqp.rabbitmq.address, has the same behavior. I have a local patch and a regression test based on 4.0.x and can open a PR if that’s useful.
I used an AI coding assistant for parts of the analysis. I reviewed and verified it myself.
Activity
[-]spring.rabbitmq.addresses doesn't decode percent-encoded credentials or virtual host[/-][+]RabbitMQ address configuration properties don't support percent-encoded values[/+][-]RabbitMQ address configuration properties don't support percent-encoded values[/-][+]RabbitMQ address configuration properties don't support percent-encoded values in the URI[/+]Use RabbitUri in PropertiesAmqpRabbitConnectionDetails
Centralize RabbitMQ URI handling
Support encoded values in AMQP URIs
challa commentedon Nov 6, 2026
For addresses with an explicit port,
RabbitUrinow decodes the username, password and virtual host withURLDecoder. That decoder handles HTML form data and turns+into a space. A literal+is valid in those parts of an AMQP URI, and RabbitMQ’sConnectionFactory.setUripreserves it.With
spring.rabbitmq.addresses=amqp://app:[email protected]:5672/orders, Boot 4.0.9, 4.1.2 and 4.2.0-RC2 usepa+ss. The4.0.10-SNAPSHOT,4.1.3-SNAPSHOTand4.2.0-SNAPSHOTbuilds tested on November 6 usepa ss.Against a local AMQP test broker configured with
pa+ss, the@RabbitListenerapplication started on 4.0.9 and failed authentication on4.0.10-SNAPSHOT:Using
StringUtils.uriDecodepreserves literal+and still decodes percent escapes, as in #50650. The second copy ofRabbitUrionmain, inspring-boot-amqp-rabbitmqforspring.amqp.rabbitmq.address, has the same behavior. I have a local patch and a regression test based on4.0.xand can open a PR if that’s useful.I used an AI coding assistant for parts of the analysis. I reviewed and verified it myself.
philwebb commentedon Nov 6, 2026
Thanks @challa, good spot. Hopefully fixed in cef5af9
Reinstate support for '+' in decoded values
Decode encoded AMQP URI values when no port is specified
Polish 'Decode encoded AMQP URI values when no port is specified'
Decode encoded AMQP URI values when no port is specified
Polish 'Decode encoded AMQP URI values when no port is specified'